Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touchmove (iOS) stops animation loop #21

Closed
rocketjoe opened this issue Nov 10, 2011 · 6 comments
Closed

Touchmove (iOS) stops animation loop #21

rocketjoe opened this issue Nov 10, 2011 · 6 comments

Comments

@rocketjoe
Copy link

After sliding on iOS (touchmove), the animation loop stops regardless pauseOnAction or animationLoop settings. After sliding left or right the animation should resume.

@tylernotfound
Copy link
Contributor

The swiping animation is working as intended. Pausing the animation loop is exactly what should happen when pauseOnAction is true, because a swipe is a declared action by the user. pauseOnHover is not a usability concept that applies to mobile, so if you don't respect pauseOnAction, sliders will get out of control and have seemingly random movements on the user.

Your issue sounds like a personal usability preference, which is fine. You can totally accomodate this. Use the after() callback to call slider.resume(). This will resume the slideshow after the animation has completed.

@rocketjoe
Copy link
Author

Yes, animation is working as intended. But I set pauseOnAction on 'false' — and I think the animation loop should then restart/resume after swiping is done. Meanwhile we tried the after-callback-solution, but then, after the first completed animation loop, flexslider is getting wild! It slides in very short intervals — uncontrollable.

@rocketjoe
Copy link
Author

Update: Got it working with a little workaround:

animation: "slide", //String: Select your animation type, "fade" or "slide"
slideDirection: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
slideshow: true, //Boolean: Animate slider automatically
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
animationDuration: 500, //Integer: Set the speed of animations, in milliseconds
directionNav: false, //Boolean: Create navigation for previous/next navigation? (true/false)
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
keyboardNav: true, //Boolean: Allow slider navigating via keyboard left/right keys
mousewheel: false, //Boolean: Allow slider navigating via mousewheel
pausePlay: false, //Boolean: Create pause/play dynamic element
randomize: false, //Boolean: Randomize slide order
slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
pauseOnAction: false, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
controlsContainer: "", //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.
manualControls: ".flex-control-nav tr td a", //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
after: function(slider){ slider.pause(); slider.resume(); }, //Callback: function(slider) - Fires after each slider animation completes
end: function(){} //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)

We had to first .pause() before .resume()! Otherwise flexslider goes crazy:

after: function(slider){ slider.pause(); slider.resume(); },

@goromlagche
Copy link

@rocketjoe put this up on a gist. Its pretty useful.

@briandowmobile
Copy link

briandowmobile commented Sep 5, 2017

On Flexslider 2 resume doesn't work.
Have to change code above to:

after: function(slider){ slider.pause(); slider.play(); },

and then is OK. Tested on my mobile and working.

@jeffikus
Copy link
Member

@briandowmobile what version within the 2.x.x release versions do you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants