$(document).ready(function(){ $('ul[class$="_slidelst"]').each(function(){ var options = { mode: 'horizontal', auto: true, autoControls: true, autoControlsCombine: true, controls: true, pager: true, speed: 750, pause: 5000, nextSelector: '', prevSelector: '', startText: '', stopText: '', onSliderLoad: function(){}, onSlideAfter: function(){}, onSlideBefore: function(){}, preloadImages: 'visible', useCSS: true, touchEnabled: true, responsive: true, keyboardEnabled: true, infiniteLoop: true } if ($(this).find('li').length === 1){ options.auto = false; options.pager = false; } if($(this).attr('class') == "rooms_slidelst"){ var roomsOptions = options; roomsOptions.auto = false; roomsOptions.autoControls = false; roomsOptions.autoControlsCombine = false; roomsOptions.nextSelector = '.ctrl_next'; roomsOptions.prevSelector = '.ctrl_prev'; roomsOptions.pause = 4000; roomsOptions.onSliderLoad = function(currentIndex){ $(".rooms_slidelst li:not([class='bx-clone'])").eq(0).addClass("active"); $("#slideNum .current-index").text("0" + (currentIndex+1)); $(".bx-clone").find("a").prop("tabIndex","-1"); }; roomsOptions.onSlideAfter = function(currentSlide, totalSlides, currentSlideHtmlObject){ currentSlide.addClass("active"); $(".rooms_slidelst").children("li").each(function(){ if($(this).attr("aria-hidden") == "false"){ $(this).find("a").attr("tabIndex","0"); }else{ //$(this).find("a").attr("tabIndex","-1"); } }); }; roomsOptions.onSlideBefore = function($slideElement, oldIndex, newIndex){ $(".rooms_slidelst").find("li").removeClass("active"); $("#slideNum .current-index").text("0"+(newIndex+1)); }; $("#slideNum").prepend(""); var roomsSlider = $(this).bxSlider(roomsOptions); $(window).bind("load resize",function(){ roomsSlider.reloadSlider(roomsOptions); }); $("#slideNum").append("0"+roomsSlider.getSlideCount()); $('.rooms_slidelst a').focusin(function(){ roomsSlider.stopAuto(); }); } }); });