question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prefer data-slick to general settings

See original GitHub issue

When 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:closed
  • Created 8 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Dan503commented, Sep 18, 2018

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?

0reactions
vikaspaturicommented, Sep 16, 2020

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”) + ‘">’ ); }, });

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found