i want to use "a waypoint" with j query and it works fine besides when i try to add an "else" statement. the idea is to scroll the text "WORK AT THIS POINT" to the top and all the text will fo to the left. It works just fine except for when i try to add the "else".
ive commented the parts that i added which stops it from working and my fiddle is below.
Please help
$('#waypoint').waypoint(function() {
// alert('You have scrolled to an entry.');
$("p").animate({left:"300px"});
}else{ // NEWLY ADDED WORKS WITHOUT
$("p").animate({left:"0px"}); // NEWLY ADDED WORKS WITHOUT
}, {
offset: '0%'
});
It appears you can capture a direction
argument in the function:
$('#waypoint').waypoint(function(direction) {
if(direction==="down") {
$("p").animate({left:"300px"});
} else {
$("p").animate({left:"0px"});
}
}, {
offset: '0%'
});
Or go here for the demo: http://jsfiddle.net/P3XnN/404/