Click (touch) inside items doesn't work on iOS
See original GitHub issueHi.
I’m trying to use Slick to display offers. Every offer has a button, that can be clicked (touched).
If property mobileFirst
set to false
- on desktop everything works fine, but on iOS 7 Safari and Chrome jQuery $('hot-tour-button').on('click' function(){...})
doesn’t work.
If property mobileFirst
set to true
- iOS starts work with click event, but desktop borwsers don’t catch this.
$(document).ready(function() {
var SLICKconfig = {
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
autoplay: true,
mobileFirst:false,
autoplaySpeed: 5000,
prevArrow:"<div class='visible-lg vv-slick-prev'><img src='/img/arrow.png'></div>",
nextArrow:"<div class='visible-lg vv-slick-next'><img src='/img/arrow.png' class='rotate'></div>",
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 1024,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
],
};
$(".carousel-contaner").slick(SLICKconfig);
});
$(".hot-tour-button").on('click',function(){
toggleShadow();
});
How should I configure Slick to make click work both, on desktop and mobile devices?
Issue Analytics
- State:
- Created 9 years ago
- Comments:13
Top Results From Across the Web
iPhone Not Responding To Touch? Here's The Fix! [2022]
David & David explain why your iPhone is not responding to touch and show you how to fix the problem for good. This...
Read more >Adjust how iPhone responds to your touch
Go to Settings > Accessibility > Touch > Touch Accommodations, then turn on Touch Accommodations. You can configure iPhone to do any of...
Read more >Navigation Item's click or touch event sometimes does not ...
I solved this problem by using UITapGestureRecognizer and UIImageView . I added both default UIBarButtonItem and customized UIBarButtonItem ...
Read more >iOS 16 Problems and Bugs with Fixes in 2022
Go to Settings> Accessibility > Touch>Turn ON Touch Accommodations>Select Use Initial Touch Location. Then turn on Swipe Gestures and select ...
Read more >How to customize your lock screen and 9 other iOS 16 tricks
Tap on Add Widgets under the time on your new screen and pick up to four small options or two big ones for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My solution was to use event delegation (jquery’s “.on()” method) from outside of the carousel’s top element (with the “slick-slider” class), targeting the elements inside the carousel. This way the event handler is unaffected by the bug.
Example:
@mikerogerz solution works perfectly. In my experience it doesn’t even appear that I need to bind this to an extra outside container element. I just use this and it works perfectly: