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

enable pauseOnHover on touch on smartphones. #555

Open
wants to merge 1 commit into
base: SlidesJS-3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions source/jquery.slides.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@
@data = $.data this
touches = e.originalEvent.touches[0]

if @options.play.pauseOnHover
@_pause()

# Setup the next and previous slides for swiping
@_setuptouch()

Expand All @@ -413,6 +416,9 @@
@data = $.data this
touches = e.originalEvent.touches[0]

if @options.play.pauseOnHover
@_restart()

# Define slides control
slidesControl = $(".slidesjs-control", $element)

Expand Down Expand Up @@ -515,18 +521,11 @@

# Stop/pause slideshow on mouse enter
slidesContainer.bind "mouseenter", =>
clearTimeout @data.restartDelay
$.data this, "restartDelay", null
@stop()
@_pause()

# Play slideshow on mouse leave
slidesContainer.bind "mouseleave", =>
if @options.play.restartDelay
$.data this, "restartDelay", setTimeout ( =>
@play(true)
), @options.play.restartDelay
else
@play()
@_restart()

$.data this, "playing", true

Expand Down Expand Up @@ -559,6 +558,23 @@
$(".slidesjs-stop", $element).hide()
$(".slidesjs-play", $element).show()

# @_pause()
# pause the slideshow
Plugin::_pause = ->
clearTimeout @data.restartDelay
$.data this, "restartDelay", null
@stop()

# @_restart()
# restart the slideshow
Plugin::_restart = ->
if @options.play.restartDelay
$.data this, "restartDelay", setTimeout ( =>
@play(true)
), @options.play.restartDelay
else
@play()

# @_slide()
# CSS3 and JavaScript slide animations
Plugin::_slide = (number) ->
Expand Down
35 changes: 24 additions & 11 deletions source/jquery.slides.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading