Pure CSS3 Realize the simulation focus carousel effect, support the JQ and other extended functions. Less nonsense, direct sticker code.
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <Metaname= "Viewport"content= "Width=device-width,initial-scale=1,maximum-scale=1">5 <Metaname= "Format-detection"content= "Telephone=no"/>6 <Metaname= "Apple-mobile-web-app-capable"content= "Yes"/>7 <MetaCharSet= "UTF-8">8 <title>Pure CSS Focus Carousel</title>9 <Linkrel= "stylesheet"href= "Css/index.css"/>Ten </Head> One <Body> A <Divclass= "Focus_img"> - <ulclass= "Img_list"> - <Li><imgsrc= "Images/swape1.jpg"alt=""/></Li> the <Li><imgsrc= "Images/swape2.jpg"alt=""/></Li> - <Li><imgsrc= "Images/swape3.jpg"alt=""/></Li> - <Li><imgsrc= "Images/swape4.jpg"alt=""/></Li> - <Li><imgsrc= "Images/swape5.jpg"alt=""/></Li> + </ul> - <ulclass= "Img_index"> + <Liclass= "One">1</Li> A <Liclass= "both">2</Li> at <Liclass= "three">3</Li> - <Liclass= "Four">4</Li> - <Liclass= "Five">5</Li> - </ul> - </Div> - </Body> in <Scriptsrc= "Js/jquery-1.11.3.js"></Script> - <Scriptsrc= "Js/index.js"></Script> to </HTML>
View Code
Next is the style code
1 Body{Background-color:#f0f0f0; }2 . Focus_img{position:relative;Height:300px;width:500px;Overflow:Hidden;margin:Auto;Border:Solid 2px #000000;3 ul {position:Absolute; }4 . Img_list{Top:0; Left:0;-webkit-animation:img_list 10s 2s infinite;5 li {width:500px;Height:300px;Overflow:Hidden;6 img {height:300px;width:500px;}7 }8 }9 . Img_index{Bottom:10px; Right:10px;Ten Li {float: Left;width:16px;Height:16px;Border:Solid 1px #cccccc;Background-color:#ffffff;Color:#000000;text-align:Center;Line-height:16px;Overflow:Hidden;cursor:Pointer;Margin-right:2px; } One . One{Background-color:#000000;Color:#ffffff;-webkit-animation:One 10s 2s infinite;} A . the{-webkit-animation:10s 2s infinite;} - . Three{-webkit-animation:three 10s 2s infinite;} - . Four{-webkit-animation:Four 10s 2s infinite;} the . Five{-webkit-animation:five 10s 2s infinite;} - } - } - @-webkit-keyframes img_list{ + 0%{-webkit-transform:Translate (0,0);} - 10%,20%{-webkit-transform:Translate (0,-300px);} + 30%,40%{-webkit-transform:Translate (0,-600px);} A 50%,60%{-webkit-transform:Translate (0,-900px);} at 70%,80%{-webkit-transform:Translate (0,-1200px);} - 90%,100%{-webkit-transform:Translate (0,0);} - } - - @-webkit-keyframes One{ - 10%,20%,30%,40%,50%,60%,70%,80%{Background-color:#ffffff;Color:#000000;} in 0%,90%,100%{Background-color:#000000;Color:#ffffff;} - } to @-webkit-keyframes{ + 0%,30%,40%,50%,60%,70%,80%,90%,100%{Background-color:#ffffff;Color:#000000;} - 10%,20%{Background-color:#000000;Color:#ffffff;} the } * @-webkit-keyframes Three{ $ 0%,10%,20%,50%,60%,70%,80%,90%,100%{Background-color:#ffffff;Color:#000000;}Panax Notoginseng 30%,40%{Background-color:#000000;Color:#ffffff;} - } the @-webkit-keyframes Four{ + 0%,10%,20%,30%,40%,70%,80%,90%,100%{Background-color:#ffffff;Color:#000000;} A 50%,60%{Background-color:#000000;Color:#ffffff;} the } + @-webkit-keyframes Five{ - 0%,10%,20%,30%,40%,50%,60%,90%,100%{Background-color:#ffffff;Color:#000000;} $ 70%,80%{Background-color:#000000;Color:#ffffff;} $ }
View Code
Finally,
Welcome to communicate correct, thank you!
Pure CSS Focus Carousel effect-feature expandable