How or, what is a good approach for this function i'm trying to create?
my_script.js
$(document).ready(function() {
$("#home").click(function() {
$('.banner').animate({top:'370px', height:'250px', }, 1000)
return false
})
$("#about").click(function() {
$('.banner').animate({top:'20px', height:'145px', }, 1000)
return false
})
$("#games").click(function() {
$('.banner').animate({top:'20px', height:'145px', }, 1000)
return false
})
$("#district").click(function() {
$('.banner').animate({top:'20px', height:'145px', }, 1000)
return false
})
$("#contact").click(function() {
$('.banner').animate({top:'20px', height:'145px', }, 1000)
return false
})
})
If an id in ["about","contact","district", "games", "membership"] - are clicked, i want to animate some stuff. But if id = "home", i want to animate (or don't animate if alreade on that page) it back.
Obviously, this code i posted doesen't work. But what kind of approach would you guys suggest? Should i put the id's for the banner to animate to the top of my page in an array and loop through it? (How does that look like) Or should i create many diffrent functions, one per id, like now?
/W