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.

Accessing Current Slide Data Attributes in onAfterChange after 1.4 update

See original GitHub issue

Previous method which was working before the update:

console.log($(slide.$slides.get(index)).attr('id'))

No longer works. Any suggestions as to how I might make this happen? Based on docs, I tried to pull .data() from var currentSlide = $('.your-element').slick('slickCurrentSlide'); but that didn’t work either.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
simeydotmecommented, Feb 16, 2015
var cur = $(".slider").slick("slickCurrentSlide");
var $slides = $(".slider").slick("getSlick").$slides;
var id = $slides.eq( cur ).get(0).id;

Thanks for contributing, but please provide a jsfiddle in future 😄

0reactions
heytomsmithcommented, Feb 16, 2015

Ok thanks, Simon. I’ll do that in the future. I’m still learning 😓. Thank you both for your help @kenwheeler.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting data-attributes from slides in slick carousel
I've tried everything I know to get the data attribute using the new method. Author show me how to get the current Slide...
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
slick is a responsive carousel jQuery plugin that supports multiple breakpoints, CSS3 transitions, touch events/swiping & much more!
Read more >
Using data attributes - Learn web development | MDN
To get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that...
Read more >
https://www.aamu.edu/_resources/ldp/galleries/slic...
Data Attribute Settings In slick 1.5 you can now add settings using the data-slick ... of current slide set, if multiple `slidesToShow`) after...
Read more >
Data Attributes | jQuery Mobile API Documentation
These attributes are completely optional; calling plugins manually and passing options directly is also supported. To avoid naming conflicts with other plugins ...
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