TouchSlider | JavaScript touch control slider | Animation library
kandi X-RAY | TouchSlider Summary
kandi X-RAY | TouchSlider Summary
JavaScript touch control slider
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of TouchSlider
TouchSlider Key Features
TouchSlider Examples and Code Snippets
Community Discussions
Trending Discussions on TouchSlider
QUESTION
I've built two kinds of functionality in controlling the slider that I've built. One is buttons with directional controls and other is touch/swipe events. How can sync both of them so that when i press prev/next the swipe events is also updated and vice versa
...ANSWER
Answered 2017-Aug-26 at 15:38You had multiple problems there:
- You used two different approaches for position the slide (the
hammer
plugin you used positioned it using translateX, while you tried to position using cssright
. - Each method used different source to determine which slide is the active one (you used the
attr
of the.slider-wrapper
while thehammer
used theactiveSlide
variable.
I fixed both to use the translateX
, moved the activeSlide
variable outside the scope of the $('.slider-wrapper .slider').each
function and made sure that every change will affect both variables.
Node that we can remove one of the variables and use only the
attr
value, but I will leave that for you :)
Here is the working snippet:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install TouchSlider
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page