Cuts a string into several strings by one character and returns as an array
var s = "Abc,abcd,aaa"= S.split (","); // decompose at each comma (,). Console.log (ss); // ["abc", "ABCD", "AAA"]
_720 in the Intercept array is replaced by _360:
functionchangelargeimg (self) {imgclear (); $("section"). Show (); //Big Picture varDATALARGESRC = $ (self). attr ("Data-largesrc"); DATALARGESRC= Datalargesrc.split (","); vartophtml = "<div class= ' Swiper-wrapper ' >"; for(varIinchdatalargesrc) {tophtml+ = "<div class= ' swiper-slide ' style= ' Background-image:url (" +datalargesrc[i]+ ") ' ></div> '; } tophtml+ = "</div>"; $(". Gallery-top"). Append (tophtml); varBTN = "<div class= ' swiper-button-next swiper-button-white ' ></div><div class= ' Swiper-button-prev Swiper-button-white ' ></div> "; $(". Gallery-top"). Append (BTN); //clone, small picture varDATASRC =Datalargesrc.slice (); varDATA360SRC = []; for(varIinchdatasrc) {Data360src.push (Datasrc[i].replace (/_720/, "_360"));//Replace finds and replaces, returns a new array, and the push is placed into the new array; } varthumbshtml = "<div class= ' Swiper-wrapper ' >"; for(varIinchdata360src) {thumbshtml+ = "<div class= ' swiper-slide ' style= ' Background-image:url (" +data360src[i]+ ") ' ></div> '; } thumbshtml+ = "</div>"; $(". Gallery-thumbs"). Append (thumbshtml); //swiper image Dynamic activation varGallerytop =NewSwiper ('. Gallery-top '), {nextbutton:'. Swiper-button-next ', Prevbutton:'. Swiper-button-prev ', Spacebetween:10 }); varGallerythumbs =NewSwiper ('. Gallery-thumbs '), {spacebetween:10, Centeredslides:true, Slidesperview:' Auto ', Touchratio:0.2, Slidetoclickedslide:true }); //bidirectional ControlGalleryTop.params.control =Gallerythumbs; GalleryThumbs.params.control=gallerytop;}
Array of string turns