为什么此代码会给我Uncaught TypeError: undefined is not a function
错误?
它发生在第4行。
$featuredslider = $(".featured-slider")
if ($featuredslider.length > 0) {
$featuredslider.royalSlider({ ********* error occurs here ********
// options go here
// as an example, enable keyboard arrows nav
keyboardNavEnabled: true,
tabs: {
// thumbnails options go gere
spacing: 0,
arrowsAutoHide: true,
fitInViewport: false,
orientation: "vertical"
}
});
slider = $featuredslider.data('royalSlider');
slider.ev.on('rsAfterSlideChange', function(event) {
if( $(window).width() < 481 ){
//console.log($(slider.currSlide.content).data("slide"))
$('.slide-overlay').removeClass("active");
$('.slide-overlay[data-slide="'+ $(this).data("slide") +'"]').addClass("active")
}
});
}