Response title
This is preview!
Hi!
I have my lightgallery opened and want before closing it
my class only to be added when the main page is scrolled down a bit.
$("#LGbest").on({
'onBeforeOpen.lg': function(event) {
$("body").removeClass("scrolled-down-top").addClass("scrolled-down-home");
console.log(event.name,event);
},
'onBeforeClose.lg': function(event) {
$("body").removeClass("scrolled-down-home");//add class if scrolled down .addClass("scrolled-down-top");
console.log(event.name,event);
}
})
snote
$(function() { $("#kuenstler").click(function(){ $("body").toggleClass("scrolled-down-20"); }).scroll(); });
</code>
This is the code provided by lightgallery:
<code>var $lg = $('#lightgallery'); $lg.lightGallery(); // Perform any action just before opening the gallery $lg.on('onBeforeOpen.lg',function(event){ alert('onBeforeOpen'); }); // custom event with extra parameters // index - index of the slide // fromTouch - true if slide function called via touch event or mouse drag // fromThumb - true if slide function called via thumbnail click $lg.on('onBeforeSlide.lg',function(event, index, fromTouch, fromThumb){ console.log(index, fromTouch, fromThumb); });
</code>
snote
© 2013 jQuery Foundation
Sponsored by and others.