I have added an attribute "id" to the slide. this id I need to work with, however I am not able to get this id somehow
jssor_slider2.$On($JssorSlider$.$EVT_PARK, function (slideIndex, fromIndex) {
//it fires when current slide swith to another
});
The moment this fires I want to be able to get this id, tried $(this).attr("id") and getElementById but does not work all result is undefined. This is how my slide looks like:
<div id="330" debug-id="slide-0" style="width: 600px; height: 800px; top: 0px; left: -600px; position: absolute; overflow: hidden; transform: perspective(2000px);"><div class="slider" style="transform: perspective(2000px);">uhedcwecnw0</div><div u="thumb" class="" style="display: none; transform: perspective(2000px);"><img src="http://192.168.0.16:8081/img/home.gif" style="height: 25px; transform: perspective(2000px);"></div><div style="width: 600px; height: 800px; top: 0px; left: 0px; z-index: 1000; display: none;"></div></div>
Any simple way to get this id?
Assuming you want the slide corresponding to slideIndex
or fromIndex
.
jssor_slider1.$On($JssorSlider$.$EVT_PARK, function (slideIndex, fromIndex) {
var oldSlide = $('div[debug-id="slide-' + fromIndex + '"]').attr('id');
var newSlide = $('div[debug-id="slide-' + slideIndex + '"]').attr('id');
});