jQuery

Chuyên mục gồm các bài viết chia sẻ về chủ đề Lập trình / Hệ thống thông tin

Tạo nút Scroll to Top với jQuery cho Website

Code chèn trước thẻ </body> <div id="topcontrol" title="Scroll to Top"><i class="fa fa-angle-up fa-lg fa-angle-style"></i></div> <script> $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $(‘#topcontrol’).css({bottom:"15px"}); } else { $(‘#topcontrol’).css({bottom:"-100px"}); } }); $(‘#topcontrol’).click(function(){ $(‘html, body’).animate({scrollTop: ‘0px’}, 800); return false; }); </script><div id="topcontrol" title="Scroll to Top"><i class="fa fa-angle-up fa-lg fa-angle-style"></i></div> <script> $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $(‘#topcontrol’).css({bottom:"15px"}); } else… read more »

Sidebar