Sunday, March 1, 2009

[jQuery] Problem Traversing

I am making a slideshow kind of thing on a website and im having some
trouble going back and forth from element to element this is the code

$(".next").click(function () {
$(this).closest(".ego-text").hide(2500).queue(function () {
$(this).next(".ego-text").show(2500);
});
});
$(".back").click(function () {
$(this).closest(".ego-text").hide(2500).queue(function () {
$(this).prev(".ego-text").show(2500);
});
});

As you can see I have a back and next button in every .ego-text when I
start on the first section and hit next it hides the current section
and shows the next section but if I try to go back it will hide the
the current .ego-text but not show the previous.

Also if I start on the second section for example and I go back to the
first one it works but if I try to go from the first to the second
after I went from second to first it won't work.

Any Ideas??? The .ego-text are divs

Any help is greatly appreciated

Jorge

No comments: