views:

39

answers:

1

Hi!

I've built an ajax-based website that utilizes the address jquery plugin for back forward button browser compatibility. However, since pages are fetched via ajax page conventional page refresh is not obvious and rather disorienting in terms of user navigation etc. User clicks a link, ajax fetches the page, although successful and page is fetched on screen, screen will not go on top of the page especially when the window is longer and clicked link was at the very bottom of the source page. As if nothing has changed. I've attempted to use scrollTo plugin but window scrollTop value upon testing is 0 and zero all the time, removing the address plugin the scrollTop value is now read.

Has anyone encountered the same issue?

Thank you in advance!

A: 

Take a look at

$.address.wrap(value)

http://www.asual.com/jquery/address/docs/#api-reference

Or you can use the jquery animate to scroll up. What I've done before is animate the scroling and then change the $.address.value. Like this:

$('a').click(function(e){
    e.preventDefault();
    var a = $(this);
    $('html').animate({ scrollTop: 0 }, 100, function () {
        $.address.value(a.attr('href'));
    });
});
fehays
jan
this question is still not solved if anyone out there has the same issue please post! thanks!
jan
See my edit. I think you can use preventDefault()
fehays