Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (35.34 KB, 2 trang )
Mã html để tạo Nút lên đầu trang ->
<script src=" />type="text/javascript"></script>
<div id="goTop">
demo" />
</div>
<style type="text/css">
#goTop {
cursor: pointer;
display: none;
position: fixed;
right: 50px;
bottom: 100px;
z-index: 1000;
}
</style>
<script type="text/javascript">
$(function(){
$(window).scroll(function () {
if ($(this).scrollTop() > 100) $('#goTop').fadeIn();
else $('#goTop').fadeOut();
});
$('#goTop').click(function () {
$('body,html').animate({scrollTop: 0}, 'slow');
});
});
</script>