我正在使用 SlidesJS 在一页上显示多个滑块。当滑块转换到下一张幻灯片时,我想使用回调。如何识别触发事件的滑块实例?
这是我用来初始化 SlidesJS 的 JS 代码:
$(function() {
$('.slides').slidesjs({
width: 940,
height: 528,
callback: {
loaded: function(number) {
// Use your browser console to view log
console.log('SlidesJS: Loaded with slide #' + number);
// Show start slide in log
$('#slidesjs-log .slidesjs-slide-number').text(number);
},
start: function(number) {
// Use your browser console to view log
console.log('SlidesJS: Start Animation on slide #' + number);
},
complete: function(number) {
// Use your browser console to view log
console.log('SlidesJS: Animation Complete. Current slide is #' + number);
// Change slide number on animation complete
$('.slidesjs-log .slidesjs-slide-number').text(number);
}
}
});
});
正如您在示例中看到的,complete
回调会更新每个 .slidesjs-slide-number
. 如何仅更新属于触发完整事件的滑块的幻灯片编号?