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 Attributes in onAfterChange

See original GitHub issue

I feel like I’m overlooking something obvious here. I’m successfully using onAfterChange for a few things, but I can’t seem to access the attributes of the current slide in this context. I’ve tried things like:

console.log( $(this).attr('id') );
console.log( $(slide).attr('id') );

But both report undefined, even though the slides (ie, the elements with the class slick-slide) do have id’s.

Any help on what I’m missing would be greatly appreciated! 😃

Thanks!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
spideepcommented, Sep 5, 2016

@nixon1333 .attr('data-slick-index') worked in my case.

5reactions
vinamrajaiscommented, May 27, 2015

What is $slides here?

I used $(“[data-slick-index='” +currentSlide+ “']”).attr(‘id’) to get the current Slide

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slick Carousel how to get current slide as a dom or jquery ...
Arg, apologies, I found a solution on a github issue titled Accessing Current Slide Attributes in onAfterChange #411. slider refers to the carousel, ......
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
In slick 1.5 you can now add settings using the data-slick attribute. ... use this to get the current slide so you know...
Read more >
Javascript – kenwheeler/slick how to get current slide as a dom or ...
Arg, apologies, I found a solution on a github issue titled Accessing Current Slide Attributes in onAfterChange #411. slider refers to the carousel, ......
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 >
Untitled
Slick slider get current slide index. slick-current back to being the first ... or the last Accessing Current Slide Attributes in onAfterChange #411...
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