麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 語言 > JavaScript > 正文

jQuery插件animateSlide制作多點(diǎn)滑動(dòng)幻燈片

2024-05-06 16:22:11
字體:
供稿:網(wǎng)友

本文給大家分享的是使用jQuery插件animateSlide制作多點(diǎn)滑動(dòng)幻燈片特效,十分的炫酷,有需要的小伙伴可以參考下

首頁banner的酷炫效果多來自全屏大圖的幻燈片動(dòng)畫,下面提供一種完美兼容的jquery動(dòng)畫特效:全新jquery多點(diǎn)滑動(dòng)幻燈片——全屏動(dòng)畫animateSlide(代碼完全原創(chuàng))。

直接上代碼,把html、css和jquery代碼copy到頁面上即可呈現(xiàn)完美畫面。

html代碼如下:

 

 
  1. <div class="animateSlide"
  2. <div class="animateSlideImgWrap"
  3. <div class="animateSlideImgBox present"
  4. <p class="text1">親,這是第一行標(biāo)題</p> 
  5. <p class="text2">AAAAAAAAAAAAAAAAAAAAA</p> 
  6. <!--<img class="img" alt="" src="img/1.png" />--> 
  7. <div class="img" style="width: 500px; height: 390px; background: #ffaeae; opacity: 0.6;"></div><!-- 實(shí)際項(xiàng)目中用上面注釋的半透明png圖片,目前臨時(shí)用div代替圖片 --> 
  8. </div> 
  9. <div class="animateSlideImgBox"
  10. <p class="text1">親,這是一行宣傳語</p> 
  11. <p class="text2">BBBBBBBBBBBBBBBBBBBBB</p> 
  12. <!--<img class="img" alt="" src="img/2.png" />--> 
  13. <div class="img" style="width: 500px; height: 390px; background: #aeffb2; opacity: 0.6;"></div><!-- 實(shí)際項(xiàng)目中用上面注釋的半透明png圖片,目前臨時(shí)用div代替圖片 --> 
  14. </div> 
  15. <div class="animateSlideImgBox"
  16. <p class="text1">親,這是一個(gè)奇跡啊</p> 
  17. <p class="text2">CCCCCCCCCCCCCCCCCCCCC</p> 
  18. <!--<img class="img" alt="" src="img/3.png" />--> 
  19. <div class="img" style="width: 500px; height: 390px; background: #aebdff; opacity: 0.6;"></div><!-- 實(shí)際項(xiàng)目中用上面注釋的半透明png圖片,目前臨時(shí)用div代替圖片 --> 
  20. </div> 
  21. </div> 
  22. <div class="animateSlideBtnL"><</div> 
  23. <div class="animateSlideBtnR"><</div> 
  24. </div> 

css代碼如下:

 

 
  1. .animateSlide {width100%height390pxpositionrelativebackground#f5f5f5;} 
  2. .animateSlideImgWrap {width100%height390pxpositionabsolutez-index1overflowhidden;} 
  3. .animateSlideImgWrap .present {displayblock;} 
  4. .animateSlideImgBox {width100%height390pxpositionabsolutez-index1displaynone;} 
  5. .animateSlideImgBox .text1 {font-family: Microsoft YaHei; font-size36pxline-height1.2emcolor#384cd0positionabsolute; top: 120pxz-index3white-spacenowrap;} 
  6. .animateSlideImgBox .text2 {font-family: Microsoft YaHei; font-size26pxline-height1.2emcolor: orange; positionabsolute; top: 200pxz-index3white-spacenowrap;} 
  7. .animateSlideImgBox .img {positionabsolute; left: 470px; top: 0z-index2;} 
  8. .animateSlideBtnL, 
  9. .animateSlideBtnR { 
  10. width30pxheight60pxline-height60pxfont-size20pxfont-weight700text-aligncenterbackground#ddd
  11. positionabsolute; left: 30px; top: 150pxz-index6cursorpointerdisplaynone
  12. .animateSlideBtnR {left: auto; right: 20px;} 

jquery代碼如下:

 

 
  1. (function($) { 
  2. $.fn.animateSlide = function(options) { 
  3. var defaults = { 
  4. btnL: ".animateSlideBtnL"
  5. btnR: ".animateSlideBtnR"
  6. imgBox: ".animateSlideImgBox"
  7. animateTime: 500, 
  8. delayTime: 5000, 
  9. density: 1 
  10. }; 
  11. var opts = $.extend(defaults, options); 
  12. var widthWin = $(window).width(); 
  13. $(window).resize(function() { 
  14. widthWin = $(window).width(); 
  15. }); 
  16. // 
  17. this.on("mouseenter"function() { 
  18. $(this).find(".animateSlideBtnL, .animateSlideBtnR").stop().fadeIn(400); 
  19. }).on("mouseleave"function() { 
  20. $(this).find(".animateSlideBtnL, .animateSlideBtnR").stop().fadeOut(400); 
  21. }); 
  22. return this.each(function() { 
  23. var _this = $(this); 
  24. var _btnL = _this.find(opts.btnL); 
  25. var _btnR = _this.find(opts.btnR); 
  26. var _imgBox = _this.find(opts.imgBox); 
  27. var _imgBoxCur = _imgBox.filter(".present"); 
  28. var _curText1 = _imgBoxCur.find(".text1"), _curText2 = _imgBoxCur.find(".text2"), _curImg = _imgBoxCur.find(".img"); 
  29. var _imgBoxNext = null, _nextText1 = null, _nextText2 = null, _nextImg = null
  30. var index = _imgBox.index(_imgBoxCur) || 0; 
  31. var size = _imgBox.size(); 
  32. var start = null
  33. index++; 
  34. if(index >= size) { 
  35. index = 0; 
  36. _imgBoxNext = _imgBox.eq(index); 
  37. _nextText1 = _imgBoxNext.find(".text1"); 
  38. _nextText2 = _imgBoxNext.find(".text2"); 
  39. _nextImg = _imgBoxNext.find(".img"); 
  40. _imgBox.find(".text1, .text2, .img").css("left", widthWin); 
  41. _imgBoxCur.find(".text1, .text2").css("left", (widthWin - 980) / 2 + "px"); 
  42. _imgBoxCur.find(".img").css("left", (widthWin - 980) / 2 + 470 + "px"); 
  43. _btnR.on("click"function() { 
  44. animateSlideFn(); 
  45. }); 
  46. _btnL.on("click"function() { 
  47. animateSlideFn(); 
  48. }); 
  49. start = setTimeout(function() { 
  50. animateSlideFn(); 
  51. start = setTimeout(arguments.callee, opts.delayTime); 
  52. }, opts.delayTime); 
  53. function animateSlideFn() { 
  54. if(!(_imgBoxCur.find(".text1, .text2, .img").is(":animated") || _imgBoxNext.find(".text1, .text2, .img").is(":animated"))) { 
  55. //當(dāng)前幀動(dòng)畫 
  56. _curText1.animate({ 
  57. left: parseInt(_curText1.css("left")) + 100 
  58. }, opts.animateTime * 0.6, function() { 
  59. _curText1.animate({ 
  60. left: "-510px" 
  61. }, opts.animateTime); 
  62. }); 
  63. setTimeout(function() { 
  64. _curText2.animate({ 
  65. left: parseInt(_curText2.css("left")) + 100 
  66. }, opts.animateTime * 0.6, function() { 
  67. _curText2.animate({ 
  68. left: "-510px" 
  69. }, opts.animateTime); 
  70. }); 
  71. }, 200); 
  72. setTimeout(function() { 
  73. _curImg.animate({ 
  74. left: parseInt(_curImg.css("left")) + 200 
  75. }, opts.animateTime * 0.6, function() { 
  76. _curImg.animate({ 
  77. left: "-510px" 
  78. }, opts.animateTime, function() { 
  79. _imgBox.find(".text1, .text2, .img").css("left", widthWin); 
  80. _imgBoxCur.removeClass("present"); 
  81. }); 
  82. }); 
  83. }, 400); 
  84. //下一幀動(dòng)畫 
  85. setTimeout(function() { 
  86. _imgBoxNext.addClass("present"); 
  87. _nextText1.animate({ 
  88. left: (widthWin - 980) / 2 - 100 
  89. }, opts.animateTime, function() { 
  90. _nextText1.animate({ 
  91. left: (widthWin - 980) / 2 
  92. }, opts.animateTime * 0.6); 
  93. }); 
  94. setTimeout(function() { 
  95. _nextText2.animate({ 
  96. left: (widthWin - 980) / 2 - 100 
  97. }, opts.animateTime, function() { 
  98. _nextText2.animate({ 
  99. left: (widthWin - 980) / 2 
  100. }, opts.animateTime * 0.6); 
  101. }); 
  102. }, 200); 
  103. setTimeout(function() { 
  104. _nextImg.animate({ 
  105. left: (widthWin - 980) / 2 + 370 
  106. }, opts.animateTime, function() { 
  107. _nextImg.animate({ 
  108. left: (widthWin - 980) / 2 + 470 
  109. }, opts.animateTime * 0.6, function() { 
  110. index++; 
  111. if(index >= size) { 
  112. index = 0; 
  113. _imgBoxCur = _imgBox.filter(".present"); 
  114. _imgBoxNext = _imgBox.eq(index); 
  115. _curText1 = _imgBoxCur.find(".text1"); 
  116. _curText2 = _imgBoxCur.find(".text2"); 
  117. _curImg = _imgBoxCur.find(".img"); 
  118. _nextText1 = _imgBoxNext.find(".text1"); 
  119. _nextText2 = _imgBoxNext.find(".text2"); 
  120. _nextImg = _imgBoxNext.find(".img"); 
  121. }); 
  122. }); 
  123. }, 400); 
  124. }, opts.density * 1200); 
  125. }); 
  126. }; 
  127. })(jQuery); 
  128.  
  129. $(function() { 
  130. $(".animateSlide").animateSlide({ 
  131. btnL: ".animateSlideBtnL"
  132. btnR: ".animateSlideBtnR"
  133. imgBox: ".animateSlideImgBox"
  134. animateTime: 500, 
  135. delayTime: 6000, 
  136. density: 0.9 
  137. }); 
  138. }); 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 免费看一级视频 | 99最新地址 | 嗯~啊~弄嗯~啊h高潮视频 | 失禁高潮抽搐喷水h | 91久久线看在观草草青青 | 国产一区二区三区高清 | 久久精品国产99久久6动漫亮点 | 国产成人精品网站 | h色视频网站 | 国产草草视频 | 欧美另类69xxxxx 视频 | 日日草夜夜草 | tube69xxxxxhd| 麻豆911| 91网视频在线观看 | 999精品久久久 | 一级观看免费完整版视频 | 久久成人综合视频 | 偿还电影免费看 | 一级大片一级一大片 | 成人福利在线 | 精品国产91久久久久久久 | 色综合久久久久久 | 亚洲操比视频 | 中日无线码1区 | 操碰视频在线观看 | 一级毛片在线看 | 欧产日产国产精品99 | 一夜新娘第三季免费观看 | 国产精品国产成人国产三级 | 极品大长腿啪啪高潮露脸 | 蜜桃精品视频 | 成人午夜免费观看 | 欧美日韩精品中文字幕 | 欧美黄一级 | 国产羞羞视频在线免费观看 | 天天草天天干天天射 | 久久成人免费观看 | 羞羞视频免费网站含羞草 | 成人做爰高潮片免费视频韩国 | 在线观看免费视频麻豆 |