[JavaScript] jquery 实现首页焦点图滚动效果 →→→→→进入此内容的聊天室

来自 , 2021-03-12, 写在 JavaScript, 查看 134 次.
URL http://www.code666.cn/view/414a7497
  1. /*首页广告效果*/
  2. $(function () {
  3.     var len = $(".num > li").length;
  4.     var index = 0;
  5.     var adTimer;
  6.     $(".num li").mouseover(function () {
  7.         index = $(".num li").index(this);
  8.         showImg(index);
  9.     }).eq(0).mouseover();
  10.     //滑入 停止动画,滑出开始动画.
  11.     $('.ad').hover(function () {
  12.         clearInterval(adTimer);
  13.     }, function () {
  14.         adTimer = setInterval(function () {
  15.                 showImg(index)
  16.                 index++;
  17.                 if (index == len) {
  18.                     index = 0;
  19.                 }
  20.             }, 3000);
  21.     }).trigger("mouseleave");
  22. })
  23. // 通过控制top ,来显示不同的幻灯片
  24. function showImg(index) {
  25.     var adHeight = $(".content_right .ad").height();
  26.     $(".slider").stop(true, false).animate({
  27.         top : -adHeight * index
  28.     }, 1000);
  29.     $(".num li").removeClass("on")
  30.     .eq(index).addClass("on");
  31. }
  32.  

回复 "jquery 实现首页焦点图滚动效果"

这儿你可以回复上面这条便签

captcha