手机中的可滚动div锚无法正常工作

问题描述 投票:0回答:1
<div id="makeMeScrollable">
    <a data-toggle="pill" href="#prepaid-mobile">Prepaid mobile</a>
    <a data-toggle="pill" href="#postpaid-mobile">postpaid mobile</a>
    <a data-toggle="pill" href="#dth">dth</a>
    <a data-toggle="pill" href="http://rxx.pay1.in/#data">datacard</a>                              
</div>

此功能在台式机上效果很好,但在手机中效果不佳。我正在使用Smooth div scrollable library

javascript jquery html css
1个回答
1
投票

从readme.md文件:

为了使它正常工作,您还需要包含jquery.kinetic.js在您的页面上。如您所见,自从我禁用了hotSpotScrolling它在触摸设备上无法很好地工作,但是您不需要这样做那。

请记住,在移动平台上,没有滚动,只有触摸事件。您可以使用触摸将屏幕向上拖动,但必须谨慎控制它。

在当前库的第77行中,默认情况下处于关闭状态。

        // Touch scrolling
        touchScrolling: false,

您必须在JS函数调用中覆盖它。注意:您不想触摸github库代码,而是想用自己的调用对其进行补充。

您将需要添加:

<script src="js/jquery.kinetic.min.js" type="text/javascript"</script>

document).ready(function () {
$("div#makeMeScrollable").smoothDivScroll({
    touchScrolling: true,
    hotSpotScrolling: false
});

到您的网站/应用程序。


0
投票

以上逻辑不起作用。您能更新工作代码吗? @zipzit

© www.soinside.com 2019 - 2024. All rights reserved.