Reputation: 75
I have a set of three pages where I am using ScrollTo to navigate. The issue I am having is that I need page 2 to be a static page but page 1 and page 3 to run an ajax call when they are scrolled to?
I have a jsfiddle here: http://jsfiddle.net/xYaPF/
The simple solution would be to do something like this : http://jsfiddle.net/UaGjs/506/ but I can't see how to ensure the ajax gets called properly?
Thanks
Upvotes: 0
Views: 79
Reputation: 2377
moveRight.click(function(evt) {
$('#Mpage').scrollTo('#Right', 500);
//Do your ajax call for page 3
$.ajax(
//your parameter
)
});
moveLeft.click(function(evt) {
$('#Mpage').scrollTo('#Left', 500);
//Do your ajax call for page 1
$.ajax(
//your parameter
)
});
UPDATE
$(function(){
$('#Mpage').scrollTo('#MainPage', 0 );
});
$(function(){
var moveRight = $('#main_nav a.next');
var moveLeft = $('#main_nav a.prev');
var flag=true;
moveRight.click(function(evt) {
if(flag){
$('#Mpage').scrollTo('#Right', 500);
flag=false;
}
else{flag=true;
$('#Mpage').scrollTo('#MainPage',500 );
}
});
moveLeft.click(function(evt) {
if(flag){
$('#Mpage').scrollTo('#Left', 500);flag=false;
}
else
{flag=true;
$('#Mpage').scrollTo('#MainPage',500 );
}
});
Upvotes: 1