First, smug app effect:
My demand is this, the above normal sliding, click on the small card below, the above sliding area also switch to the current click state.
Second, realize:
Css:
Mainly set the location of several cards in the visible area, the attention of several places is, the middle of the activation state and the left and right side of the elements, Swiper has been running when they added a fixed class name.
Html:
<!--swiper--<div class= "Swiper-container" > <div class= "swiper-wrapper" > <div class= "Swiper-slide" > Empress <p class= "card-btn" > Give a friend </p> </div> < ;d IV class= "Swiper-slide" > World <p class= "CARD-BTN" > Give a friend a photo </p> </div> <div class= "Swiper-slide" > Star <p class= "card-btn" > Give a friend </p> </div> <div class= "Swiper-slide" > Moon <p class= "Card-btn" > Give a friend a photo </p> </div& Gt <div class= "Swiper-slide" > Magician <p class= "card-btn" > Give a friend a photo </p> </div> <div class= "Swiper-slide" > Sun <p class= "card-btn" > Give a friend a photo </p> </div> ; </div> </div> <div class= "Contrast-box" > <ul> <li data-index= "5" > MagicDivision </li> <li data-index= "6" > Sun </li> <li data-index= "1" > Empress </li> <li data-index= "2" > World </li> <li data-index= "3" > Stars </li> <li data-index= "4 "> Moon </li> <li class=" combin-btn "> Crafting </li> </ul> </div> <div class= "Button-next" ></div> <div class= "Button-prev" ></div>
Javascript:
var myswiper = new Swiper ('. Swiper-container ', { nextbutton: '. Swiper-button-next ', Prevbutton: '. Swiper-button-prev ', effect: ' Coverflow ',//3d sliding grabcursor:true, centeredslides:true, Slidesperview: ' Auto ', loop:true, slidesperview:2, coverflow: { rotate:0, //set to 0 stretch:0, depth:200, modifier:2, slideshadows:true } }); $ ('. Contrast-box '). On (' Click ', ' Li:not (. combin-btn) ', function () { var _index = $ (this). Data (' index ') + 1; Myswiper.slideto (_index, x, False);//Switch to the first slide with a speed of 1 seconds }); $ ('. Button-prev '). Click (function () { myswiper.slideprev (); }) $ ('. Button-next '). Click (function () { myswiper.slidenext (); })
To achieve the effect of the Love app, just set a little style on the left and right elements of the middle active element.
Iii. Summary
Swiper to the low version of IE browser and some low-end phone support is not very good, after all, swiper use some advanced C3 properties, but can be learned from the implementation of swiper the principle of a lot of dry.
Swiper to realize the swipe effect of smug app