Reputation: 35
i want to have more than one div id to start this animation. Why is this not working?
I mean this:
$("#treest, #treest2, #treest3").click(function() {
anim10();
});
Here is the Full Code
/** ANIMATE DropDown */
var $a = $("#navigation"),
$b = $(".mainNavitem:eq(1)"),
$c = $(".c");
function anim1() {
$b.animate({width: 395}, {duration: 300, complete: anim2});
}
function anim2() {
$a.animate({top:"70px"}, {duration: 400});
$c.animate({top:"70px"}, {duration: 400});
}
$("#mains").click(function() {
anim1();
});
function anim10() {
$c.animate({top:"0px"}, {duration: 200});
$a.animate({top:"0px"}, {duration: 200 , complete: anim20});
}
function anim20() {
$b.animate({width: 80}, {duration: 200});
}
$("#treest, #treest2, #treest3").click(function() {
anim10();
});
Do you have any Idea how I can fix this?
EDIT:
Upvotes: 0
Views: 95
Reputation: 792
Are you running your code with $(document).ready() event? like
jQuery(function(){
$("#mains").click(function() {
anim1();
});
$("#treest, #treest2, #treest3").click(function() {
anim10();
});
})
Upvotes: 2