Prefer data-slick to general settings
See original GitHub issueWhen using the attribute “data-slick”…
<div class="slick" data-slick='{"dots":false,"arrows":true}'>
together with a set of general options…
$('.slick').slick({
dots: true,
infinite: true
});
the default options are preferred: In the example above, the slider has dots although the setting in the data-attribute says “no dots”.
For me, it seems more logical if the settings in “data-slick” overwrites the general options. For usage in a CMS this is highly recommended.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Use data-slick to store options, dropped supporting Slick 1.4.x
From the start, the module always stores user settings at data-config attributes. We could not use data-slick prior to Slick 1.5, ...
Read more >Adding a carousel to my homepage showing my categories
Hello @Sarah Pascoe (Customer) ,. It looks like this theme uses the same "data-slick" property to add a carousel to an element.
Read more >accessible-slick - the last (accessible) carousel you'll ever need
Just simple, semantic elements like lists and buttons. The accessibility setting has been deprecated since this package is accessible by default!
Read more >How to connect Slick slider in Shopify - Glivera Team
This is the main setting, the rest we will configure via the theme admin panel. ... attribute data-slick , which will help us...
Read more >Solved: Slider not working properly - Shopify Community
Everything looks okay, but I've never used the data-slick attribute ... understand what is stoping the settings in schema to work properly?
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
This is the completely wrong approach in my mind.
The JS will typically be called on a generic
.carousel
class.The data attribute is called on the individual carousels. This gives much finer control of the settings to the data attribute.
If there are arguments for both sides then can we have a setting that determines what batch of settings have priority?
Hi Team,
How do we pass this as the Data attribute, I am looking for customPaging for below.
$(“.cmp-carousel-single”).slick({ slidesToShow: 1, dots: true, infinite: false, arrows: true, customPaging: function (slider, i) { return ( ‘<img src="’ + $(slider.$slides[i]) .find(“.cmp-carousel__content-wrapper”) .attr(“data-dot-title”) + ‘">’ ); }, });