David Simon David Simon - 6 months ago 43
Javascript Question

Scroll to top after history.back

Sorry, but my english is very bad.

How can I do to scroll to top in a php-site after use history.back?

Example: The page1.php is active. I use history.back to come back
to page0.php. page0.php is not loading again, but i will scroll
to top with jquery.

How can I do that?

Bye, David


Use below script in that page, in which you want to go to top of page.

<script type="text/javascript">
    $(window).bind("pageshow", function() {
        $("html, body").animate({
           scrollTop: 0
        }, 600);