I have tested this code and it works perfectly in Edge, Firefox and Chrome in all versions but will not work in IE11 or older. I am looking to either find my issue or create better version that will work in older browsers. I have a few clients that refuse to upgrade dont ask lol.
Error Received: Unexpected Identifier, string or number
The only thing on google I could find is that it references trailing commas but I dont have any in the code below. I commented out the sections that are broken.
// Slideshow System
var s = Foundation.MediaQuery.get('medium').match(/\(([^)]+)\)/)[1].replace('em','').split(' ');
var small = (s[(s.length-1)]*16);
var m = Foundation.MediaQuery.get('large').match(/\(([^)]+)\)/)[1].replace('em','').split(' ');
var medium = (m[(m.length-1)]*16);
$('.omada-ss').each(function(){
var x = $(this);
if(x.attr("id") !== undefined){ var id = x.attr('id'); }else{
var id = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 5; i++){ id += possible.charAt(Math.floor(Math.random() * possible.length));}
x.attr('id',id);
}
if (!x.hasClass("swiper-container")){ x.addClass('swiper-container'); }
if(x.find('div.swiper-wrapper').length == 0){ x.wrapInner('<div class="swiper-wrapper"></div>'); }
x.find('.swiper-wrapper>div').each(function(){ if(!$(this).hasClass("swiper-slide")){ $(this).addClass('swiper-slide');} });
if(x.hasClass('has-text')){ x.find('.spiper-slide').each(function(){ $(this).wrapInner('<div class="swiper-text"></div>'); }); }
if(x.data("options") !== undefined){ var options = film = x.data("options"); }
else{ var options = film = {autoplay: { delay: 2500, disableOnInteraction: true } } }
/*
if('breakpoints' in options){ options.breakpoints = { [medium] :options.breakpoints.medium, [small] : options.breakpoints.small }; }
if('spaceBetween' in options){ options.spaceBetween = parseInt(options.spaceBetween); }
if('pagination' in options){ x.append('<div class="swiper-pagination"></div>'); }
if('navigation' in options) { x.append('<div class="swiper-button-next"></div><div class="swiper-button-prev"></div>'); }
if('speed' in options){ options.speed=film.speed=parseInt(options.speed); }
*/
var swiper = new Swiper('#'+id,options);
if('filmstrip' in film){
delete film.navigation;
delete film.pagination;
/*
if('breakpointsbs' in film){
film.breakpoints={ [medium] :film.breakpointsbs.medium, [small] : film.breakpointsbs.small };
film.slidesPerView = parseInt(film.breakpointsbs.large.slidesPerView);
film.centeredSlides=true;
delete film.breakpointsbs;
}
*/
film.touchRatio=0.2;
film.slideToClickedSlide=true;
var thumbs = new Swiper('#'+id+'-filmstrip', film);
swiper.controller.control = thumbs;
thumbs.controller.control = swiper;
}
if('pauseonhover' in options){ x.hover(function(){swiper.autoplay.stop();},function(){swiper.autoplay.start();}); }
});
Below is a sample div with the class and options attached
<div id="UBMoSlzKfT" class="swiper-container omada-ss" data-options='{"pauseonhover":true,"autoplay":{"delay":"5000","disableOnInteraction":false},"loop":true,"speed":"2000","navigation":{"nextEl":".swiper-button-next","prevEl":".swiper-button-prev"},"keyboard":{"enabled":true}}'>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</div>
inoperators are not well supported in old versions of IE. What are the values formediumandsmall?