Granular / Bubbling check for noSwiping slides #329
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello there,
I'm using your
noSwiping
class feature and ran across a slight issue inonTouchStart
(line 1097):The issue here is that the
event.target.className.indexOf..
check is only performed on the top-most element.Meaning, if I have a label (
div
) inside my swiper slide, the check is performed only on the label, not on the containing swiper slide.I added a function just below your events section that checks for
noSwipingClass
in the existing element, and all parent elements up through thewrapperClass
. If it doesn't find it by then, it will return false, meaning that it is ok to swipe. If it does find it, it will return true, meaning that it is not okay to keep swiping.I also modified the check inside of
onTouchStart
(line 1097) to use the new function.I'm hoping that this will give your library some increased functionality/control, by allowing you to be very granular (or very lazy) with seting
noSwiping
. Some examples:noSwipingClass
to the wrapper:In the above example, swiping is only allowed on the first and last 15% of the page. The middle section won't allow swiping.
I'm sure there's probably a more effective way to do this, but I'll leave that up to you.
It will make for some good functionality, though, and at the very least 'fix' an existing issue with child elements in a swiper slide.
Hope this helps. Great library!
Strack