Ascensor.js icon indicating copy to clipboard operation
Ascensor.js copied to clipboard

Event "scrollend" with delay

Open xmon opened this issue 7 years ago • 1 comments

Hi @kirkas

The "scrollend" event is delayed in a certain circumstance.

To play it, if you set "queued" to "y" and we are on one floor and we want to go to another floor that is on the same "y" axis. The "scrollend" event is launched with a delay of 1 or 2 seconds.

With the same configuration "queued" in "y", if we are on one floor and we want to go to another floor that is not in the same axis "y" and therefore has to move by 2 axes, the event "scrollend" Is launched without delay, at the same time that the animation ends.

Any idea to solve it?

thanks a lot

xmon avatar Apr 08 '17 10:04 xmon

This is my workaround in my own code

        $(".links-to-floor li").click(function (event, index) {
        
            // here your check if need redefine "queued"
            if(...){
                    ascensorInstance.options.queued = "y";
            } else {
                    ascensorInstance.options.queued = "x";
            }
            ascensorInstance.scrollToFloor($(this).index());
        });

I have checked the source and the destination, to know which configuration for "queued" is needed, here a very basic example:

         var current = ascensor.data("current-floor");
         var destination = $(this).index();
         // for example
         if(current === 0 && destination === 6){
                    ascensorInstance.options.queued = "y";
         }

I hope it helps, as long as this BUG is not solved in the plugin.

xmon avatar Apr 08 '17 11:04 xmon