Purpose: Navigation has multiple, clicked item centered display.
Html:
<Divclass= "Swiper-container"> <Divclass= "Swiper-wrapper"> <Divclass= "Swiper-slide">Slider1</Div> <Divclass= "Swiper-slide">Slider2</Div> <Divclass= "Swiper-slide">Slider3</Div> <Divclass= "Swiper-slide">Slider4</Div> <Divclass= "Swiper-slide">Slider5</Div> <Divclass= "Swiper-slide">Slider6</Div> <Divclass= "Swiper-slide">Slider7</Div> <Divclass= "Swiper-slide">Slider8</Div> <Divclass= "Swiper-slide">Slider9</Div> </Div></Div>
Js:
varMyswiper =NewSwiper ('. Swiper-container '), { //autoplay:true,//optional option, Auto slideLooptrue,//Set Active Slide Center, there will be left and right left white phenomenon, add this will let the unfinished navigation before and after blankSlidetoclickedslide:true,//set to True then clicking Slide will transition to this slide. Slidesperview:5, Centeredslides:true,//when set to True, the active slide is centered instead of left in the default state. Spacebetween:10, Slidesoffsetbefore:0, Slidesoffsetafter:0,}) $('. Swiper-container. Swiper-slide '). On ("click",function(){ //myswiper.activeindex transition to the slide positionMyswiper.slideto (Myswiper.activeindex, 1000,false);//switch to the specified slide with a speed of 1 seconds })
The style is not modified, and the active item is always displayed in the middle when only the effect is achieved.
Because of the time problem, no more time cloud to see the document, if there is a better way to remove the current center left and right left white question, welcome comments.
Using Swiper to make navigation, click the Item Center