开发者

javascript scroll back to the top

how can I get this scroll back to the top neat thing from this link , just scroll down a bit, you'll see in t开发者_JS百科he bottom right icon(top pointer) that scrolls back to the top on click. Thank you


In jQuery:

$(document).ready(function() {

    $('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });

});

You can then make links like this:

<a href="#top" title="Scroll back to the top">Back to the top</a>


You can find the script here: http://www.javascriptkit.com/jkincludes/scrolltopcontrol.js

Although you need to use jquery for this script to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜