jQuery實現(xiàn)花式輪播之圣誕節(jié)禮物傳送效果
旋轉(zhuǎn)出發(fā),旋轉(zhuǎn)到達(dá)。鼠標(biāo)經(jīng)過停止,點(diǎn)擊拆禮物!
寫的比較簡單,喜歡點(diǎn)贊收藏哦。
請在谷歌等高版本瀏覽器打開^-^
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>圣誕禮物傳送輪播</title> <style> html, body { height: 100%; margin: 0; padding: 0; } .cr{ width: 100%; position: relative; background: url("http://cdn.attach.qdfuns.com/notes/pics/201612/15/174106gbm3famm0piq62mm.png") no-repeat 0 0; -webkit-background-size: 100% 100%; background-size: 100% 100%; overflow: hidden; } .cr-l,.cr-r{ position: absolute; bottom:10%; width: 20.8%; height: 70%; z-index:100; } .cr-l img,.cr-r img{ width: 100%; position: absolute; top:50%; } .cr-l{ left: 0; } .cr-r{ right:0; } .cr-icon{ bottom: 15%; left:0; position: absolute; z-index: 1000; width: 100%; height: 70%; text-align: center; } .cr-icon img{ margin-right: 25px; width: 10%; vertical-align: top; position: absolute; bottom: 0; opacity: 1; transform:rotate(0deg); transition: all 1s; } .cr-icon img:first-child{ transform:rotate(-90deg); -webkit-transform:rotate(-90deg); opacity: 0; width: 0; } .cr-icon img:last-child{ transform:rotate(90deg); -webkit-transform:rotate(90deg); opacity: 0; width: 0; } </style> </head> <body> <div class="cr"> <div class="cr-l"><img src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103o5zx1pzh4x1ccpcb.png" alt=""/></div> <div class="cr-icon"> <div id="cr-icon"> <img style="left:5%" src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png" alt=""/> <img style="left:25%" src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png" alt=""/> <img style="left:45%" src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png" alt=""/> <img style="left:65%" src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png" alt=""/> <img style="left:85%" src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png" alt=""/> </div> </div> <div class="cr-r"><img src="http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103dz0uhvec7nbunqwc.png" alt=""/></div> </div> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(".cr-icon img").click(function(){ if($(this).attr("src") == "http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png"){ $(this).attr("src","http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103ciomobruzrkbhhs5.png"); }else{ $(this).attr("src","http://cdn.attach.qdfuns.com/notes/pics/201612/15/174103e22y4zbkhi47bi2w.png"); } }); $(function() { var end = document.body.clientWidth; var height = document.body.scrollHeight; $(".cr").css("height",height); function scrollLogo() { $("#cr-icon img").each(function () { var left = parseInt($(this).css("left")); left += end * 0.2; $(this).css("left", left + "px"); }); $("#cr-icon img:last").insertBefore($("#cr-icon img:first")).css("left", document.body.clientWidth * 0.05).fadeIn(); } setTimeout(scrollLogo,0); var scroll = setInterval(scrollLogo, 1500); $("#cr-icon img").mouseenter(function () { clearInterval(scroll); }); $("#cr-icon img").mouseleave(function () { scroll = setInterval(scrollLogo, 1500); }); }); </script> </body> </html>
效果圖如下所示:
以上所述是小編給大家介紹的jQuery實現(xiàn)花式輪播之圣誕節(jié)禮物傳送效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
基于jQuery實現(xiàn)左右div自適應(yīng)高度完全相同的代碼
最近做前端設(shè)計時需要使左右兩個DIV高度自適應(yīng)。這其中的jquery代碼中的獲得高度用的clientHeight,介紹一下幾種不同的獲得方式以及他們的差別2012-08-08jquery $.each 和for怎么跳出循環(huán)終止本次循環(huán)
如何在jquery 中的循環(huán)中終止本次循環(huán)或者跳出循環(huán)呢?經(jīng)搜索發(fā)現(xiàn)個不錯的方法,大家不妨參考下,希望對大家有所幫助2013-09-09JQuery實現(xiàn)動態(tài)適時改變字體顏色的方法
這篇文章主要介紹了JQuery實現(xiàn)動態(tài)適時改變字體顏色的方法,實例分析了jQuery操作鼠標(biāo)事件及顏色的技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-03-03jQuery實現(xiàn)下拉菜單動態(tài)添加數(shù)據(jù)點(diǎn)擊滑出收起其他功能
這篇文章主要介紹了jQuery實現(xiàn)下拉菜單動態(tài)添加數(shù)據(jù)點(diǎn)擊滑出收起其他功能,本文給大家介紹的非常詳細(xì),需要的朋友可以參考下2018-06-06jquery取子節(jié)點(diǎn)及當(dāng)前節(jié)點(diǎn)屬性值的方法
這篇文章主要介紹了jquery取子節(jié)點(diǎn)及當(dāng)前節(jié)點(diǎn)屬性值的方法,比較實用,需要的朋友可以參考下2014-09-09擴(kuò)展Jquery插件處理mouseover時內(nèi)部有子元素時發(fā)生樣式閃爍
在我們對一個dom添加mouseover和mouseout時,也就是jquery的hover事件,如果該dom有子元素,鼠標(biāo)移到子元素時會觸發(fā)mouseout事件,但往往實際情況我們希望在子元素上不觸發(fā)out事件2011-12-12