Strange Element Array
Strange Element Array
I'm new to jquery but have good experience with mootools, but my new project I'm trying out jquery... I am getting to grips with it however I'm a bit confussed at how this code is working;
I have four buttons and four ul's which are placed into array... Yet when you click the 1st and 2nd button they both animate the first ul like its in both position 0 & 1 of the array.
I'm guessing it to do with the following(is there a better way to achieve this)?
-
$j("#modules div ul:eq("+(clickPos+1)+")")
Full Code
-
var moduleBtns = $j('a.btn');
var moduleNavs = $j('#modules div ul');
var clickPos = 0;
moduleBtns.click(function(ev) {
ev.preventDefault();
clickPos = moduleBtns.index($j(this));
$j("#modules div ul:eq("+(clickPos+1)+")").animate({
"height" : "300px"
}, {
duration:1000,
easing: "easeOutBounce"
})
});