javascript - How to achieve the return to top effect on the mobile phone? (The scroll bar on the mobile phone will be hidden and cannot be detected) The anchor function of the sui framework a I use cannot be used. Is there a js method?
ringa_lee
ringa_lee 2017-05-16 13:31:29
0
1
1033

Like the title, because the sui framework is used, the anchor link effect of a has no effect. Although I disabled the routing function, it still doesn’t work. Is there any js method to return to the top? Or is there any master who is familiar with the sui framework, how should I achieve it? ?

ringa_lee
ringa_lee

ringa_lee

reply all (1)
Peter_Zhu
//当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失 $(function () { $(window).scroll(function () { if ($(window).scrollTop() > 100) { $("#back-to-top").fadeIn(1000); console.log($(window).scrollTop()) console.log(window.innerHeight) } else { $("#back-to-top").fadeOut(1000); } }); //当点击跳转链接后,回到页面顶部位置 $("#back-to-top").click(function () { $('body,html').animate({scrollTop: 0}, 1000); return false; }); });

I wrote a small demo that can be triggered

    Title        

我是主体内容

返回顶部

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!