I was wondering if anyone can help me with this scrolling problem using the scrollTo plugin for jquery.I want to be able to scroll one h2 element at a time with one click...in my script it scrolls across all h2 elements with one click..Help me please guys!!
$(document).ready(function(){
$('#down').click(function(){
$("#container h2").each(function(i,h2){
$("#wrap").scrollTo(h2, 800, { axis:'y' });
});
});
$('#up').click(function(){
$("#container h2").reverse().each(function(i,h2){
$("#wrap").scrollTo(h2, 800, { axis:'y' });
});
});
jQuery.fn.reverse = function() {
return this.pushStack(this.get().reverse(), arguments);
};
});