use Jquery-1.4.4.min.js:
<script src="../../Scripts/jquery-1.4.4.min.js" type="text/javascript"></script>
Top.js:
$(document).ready(function () {
var show_delay;
var scroll_left = parseInt((document.body.offsetWidth - 960) / 2) + 961;
$(".scroll").click(function () {
document.documentElement.scrollTop = 0;
document.body.scrollTop = 0;
});
$(window).resize(function () {
scroll_left = parseInt((document.body.offsetWidth - 960) / 2) + 961;
$(".scroll").css("left", scroll_left);
}); reshow(scroll_left, show_delay);
});
function reshow(marign_l, show_d) {
$(".scroll").css("left", marign_l);
if ((document.documentElement.scrollTop + document.body.scrollTop) != 0) {
$(".scroll").css("display", "block");
}
else { $(".scroll").css("display", "none"); }
if (show_d) window.clearTimeout(show_d);
show_d = setTimeout("reshow()", 500); }
CSS:
<style type="text/css">
.scroll{ bottom:100px;cursor:pointer; text-align:center;
height:35px;width:35px;position:fixed;
border:2px solid black; background-color:#dab766;}
</style>
Html:
<p>there is top....</p>
<div style=" height:980px;"></div>
<div class="scroll">Top</div>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。