[html] 回到页首
[转]本文来自:最简单最强大的插件框架(Net 2.0+)
http://www.cnblogs.com/baihmpgy/p/3305215.html
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> #toTop{ width:100px; border:1px solid #ccc; background:#f7f7f7; text-align:center; padding:5px; position:fixed; bottom:10px; right:10px; cursor:pointer; display:none; color:#333; font-size:11px; } </style> </head> <body> <div style="height:2000px;">http://www.iopenworks.com/Documents/DocumentsList</div> <script src="js/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $('#Documents').addClass("currentPage"); $(window).scroll(function () { if ($(this).scrollTop() > 200) { $('#toTop').fadeIn(); } else { $('#toTop').fadeOut(); } }); $('#toTop').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); }); }); </script> <div id="toTop">^ Top</div> </body> </html>