isroll停止滚动左/右(水平),不为我工作,我做错了

iScroll stop scrolling left/right (horizontal), not working out for me am I doing it wrong?

本文关键字:工作 错了 水平 滚动 isroll      更新时间:2023-09-26
function iScrollLoaded()
{
//(function($){
    myScroll = new iScroll('wrapper',
    {
        hideScrollbar:true,
        hScroll:false,
        bounce:true,
        lockDirection:true,
    });
//})(jQuery)
}
document.addEventListener('DOMContentLoaded', iScrollLoaded, false);

据我所知,如果从isroll页面,这应该阻止屏幕从能够向左/向右拖动,但是…似乎它持有没有效果,无论如何保持滚动包装从左/右拖动还是我在这里做错了吗?

HTML使用的基本例子..

<div id="page">
    <div id="header" class="clearfix">
        <div class="header_logo">
            <a href="domain.com/" title="domains">
                <img src="/logo_600.png" style="border:none;" alt="">
            </a>
        </div>
    </div><!-- /header -->
    <!-- sub_nav -->
    <!-- /sub_nav -->
    <div id="wrapper" class="no_snav">
        <div id="scroller" class="overthrow">   
        <div>This profile is currently unavailable or does not exist.</div>
        <div id="geolocation_latlng" style="visibility:hidden;"></div>
        </div><!-- /scroller -->
    </div><!-- /wrapper -->
</div><!-- /page -->

这是你的代码块。这里指定hScroll:false。它表示禁用水平滚动。设置为hScroll:true并检查。

代码

function iScrollLoaded()
{
//(function($){
    myScroll = new iScroll('wrapper',
    {
        hideScrollbar:true,
        hScroll:false, /* THIS SHOULD BE TRUE FOR HORIZONTAL SCROLLING */
        bounce:true,
        lockDirection:true,
    });
//})(jQuery)
}
document.addEventListener('DOMContentLoaded', iScrollLoaded, false);