Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

scrollEnd event fires twice if snap option is set to true #761

Closed
samuelgoldenbaum opened this issue Jul 27, 2014 · 8 comments
Closed

scrollEnd event fires twice if snap option is set to true #761

samuelgoldenbaum opened this issue Jul 27, 2014 · 8 comments
Assignees

Comments

@samuelgoldenbaum
Copy link

myScroll = new IScroll('#wrapper', {
        scrollbars: true,
        mouseWheel: true,
        interactiveScrollbars: true,
        snap: true // this causes the scrollEnd event to fire twice
    });
    myScroll.on('scrollEnd', function(e) {
        console.log('done'); // scrollEnd event firing twice
    });

http://jsfiddle.net/ALgV3/

@frankie-loves-jesus
Copy link

Seems to me like it's interactiveScrollbars that's causing it?

@samuelgoldenbaum
Copy link
Author

Seems that adding both snap and interactiveScrollbars causes the issue. Perhaps fire a different event for snap like 'snapEnd' . Unfortunately, I need both :-(

@samuelgoldenbaum
Copy link
Author

Anyone have any pointers for a fix here?

mcountis added a commit to mcountis/iscroll that referenced this issue Sep 18, 2014
cubiq#761

On wheelscroll the scrollEnd event was firing twice. Once from _transitionEnd (core.js) and once from a timeout in _wheel (wheel.js).

Placed a check in _transitionEnd to only fire scrollEnd event if _wheel's scrollEnd event is already set to execute.
@notdotscott
Copy link

Setting interactiveScrollbars to false still causes the issue, at least it does on that jsfiddle example.

@fanmanpro
Copy link

Still experiencing this issue. Is there a known fix/hack I can use?

@sculove
Copy link
Collaborator

sculove commented Mar 30, 2016

@Fanus I will check it

@sculove sculove self-assigned this Mar 30, 2016
@sculove
Copy link
Collaborator

sculove commented Apr 1, 2016

iscroll fires two scrollEnd events when using mousewheel:true and snap:true options

  • _wheel fire scrollEnd event.
  • _transitionEnd fire scrollEnd event.

@sculove sculove closed this as completed in eed1f7b Apr 1, 2016
@sculove
Copy link
Collaborator

sculove commented Apr 1, 2016

I merged on master branch

aisouard pushed a commit to Mappy/iscroll that referenced this issue Feb 22, 2017
when using mousewheel:true and snap:true options

Close cubiq#761
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants