mreq / slick-lightbox

A lightbox wrapper for Ken's amazing slick carousel.
http://mreq.github.io/slick-lightbox/
MIT License
229 stars 103 forks source link

Is there a way to use afterChange/beforeChange? #52

Closed jackharding closed 6 years ago

jackharding commented 7 years ago

Hey. Love this plugin. Is there any way I can access beforeChange and afterChange events using this plugin?

mreq commented 6 years ago

Sure, you can bind to slick directly. See https://github.com/mreq/slick-lightbox#lightbox-instance

shivanit2 commented 6 years ago

can somebody please state an example of how to use afterChange and beforeChange with this plugin?I am not able to understand how to use the slick instance.Please can someone help me out with what this states console.log('My slick instance:', $('#my-element')[0].slickLightbox.slick) ?

mreq commented 6 years ago

You don't need the instance for that. Also, please, ask support questions on StackOverflow or similiar, not in GH issues.

Anyways:

$(document).on('beforeChange', '.slick-lightbox .slick-slider', function(event, slick, currentSlide, nextSlide){
  console.log(nextSlide);
})
shivanit2 commented 6 years ago

Thank you so much!And yes,I will use stack next time.Sorry. It is just that currently I am using the forked version - the one which has added video support .And I need to use the beforeChange and afterChange events for the same. https://github.com/mreq/slick-lightbox/issues/11

So ,Can I use the events for the forked version too in the same way as you stated?Thanks.