I am working on a slider that adds a class (.current-item) to each active tab and removes it when it's inactive. I am looking to incorporate the LavaLamp effect for the menu, but I am having trouble getting the position of each element with the current-item class.
So far, I have tried the following code:
var my = $("li.current-item");
var myposition = my.position();
function setCurr(el) {
$back.css({'top': myposition.top });
curr = el;
};
However, this code only works for the first item. Once the slider removes the class from one item and adds it to the next, the positioning does not update.
You can view the live version here: http://asgg.ro/slider-html/ The script source is located at the bottom of the page.
As a beginner in jQuery, I could really use some guidance! Thank you in advance.