search

Home  >  Q&A  >  body text

javascript - Is there a callback function for iscroll.js? How to use it?

1. About the callback function of iscroll? Let me first ask if this framework has a callback function?
2. How to trigger other functions after myscroll.scrollTo(0,10,200,true) is completed? How to write?
3. Just like the takeout example, after the scroll on the right is completed, the menu on the left also scrolls to the corresponding position. Wait online! There is a bug in the height when I use swiper. The content of each screen is different (the content is high and low. ) cannot roll to the specified target position,
is always misaligned

我想大声告诉你我想大声告诉你2700 days ago928

reply all(1)I'll reply

  • 世界只因有你

    世界只因有你2017-07-05 10:48:43

    1

    The callback function is not clear, I did it by monitoring events

    2

    myScroll = new IScroll('#wrapper');
    myScroll.on('scrollEnd', doSomething);

    The events that can be linked to are as follows:

    • beforeScrollStart, triggered when the user touches the screen but has not yet started scrolling.

    • scrollCancel, scrolling initialization is completed but not executed.

    • scrollStart, start scrolling

    • scroll, triggered when the content is scrolled, only valid in scroll-probe.js version, please refer to onScroll event.

    • scrollEnd, triggered when scrolling stops.

    • flick, user opens left/right.

    • zoomStart, start zooming.

    • zoomEnd, zoom ends.

    3

    Your content area may have changed (for example, there are pictures). At this time, you need to reloaddowniscroll

    ajax('page.php', onCompletion);
    
    function onCompletion () {
        // Update here your DOM
    
        setTimeout(function () {
            myScroll.refresh();
        }, 0);
    };

    reply
    0
  • Cancelreply