简体   繁体   中英

scrollable div anchor in mobile not working

<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>

This is working well on the desktop but not in mobile phones. I am using the Smooth div scrollable library

From the readme.md file:

In order for this to work you also need to include jquery.kinetic.js on your page. As you can see I have disabled hotSpotScrolling since it's not working very well on touch devices, but you don't need to do that.

Remember on mobile platforms, there is no scrolling, only touch events. You can use touch to drag the screen up, but you've got to control it carefully.

In the current library, line 77, is shut off by default.

        // Touch scrolling
        touchScrolling: false,

You have to override that in your JS function calls. Note: you don't want to touch the github library code, you want to supplement it with your own calls.

You will need to add:

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

and

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

to your website / app.

Above logic is not working. can you please update the working code? @zipzit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM