最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮_jquery

来源:动视网 责编:小采 时间:2020-11-27 21:14:24
文档

jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮_jquery

jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮_jquery:jquery左右滚动焦点图banner图片,鼠标经过显示上下页 适合宽和高都比较大的页面使用 演示 代码如下: 代码如下: @charset utf-8; img { border: 0px; } .bannerbox { width: 320px; height: 150px
推荐度:
导读jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮_jquery:jquery左右滚动焦点图banner图片,鼠标经过显示上下页 适合宽和高都比较大的页面使用 演示 代码如下: 代码如下: @charset utf-8; img { border: 0px; } .bannerbox { width: 320px; height: 150px
 jquery左右滚动焦点图banner图片,鼠标经过显示上下页
适合宽和高都比较大的页面使用

演示
代码如下:















  • 代码如下:
    @charset "utf-8";
    img { border: 0px; }
    .bannerbox { width: 320px; height: 150px; overflow: hidden; margin: 0px auto; }
    #focus { width: 320px; height: 150px; clear: both; overflow: hidden; position: relative; float: left; }
    #focus ul { width: 320px; height: 150px; float: left; position: absolute; clear: both; padding: 0px; margin: 0px; }
    #focus ul li { float: left; width: 320px; height: 150px; overflow: hidden; position: relative; padding: 0px; margin: 0px; }
    #focus .preNext { width: 250px; height: 150px; position: absolute; top: 0px; cursor: pointer; }
    #focus .pre { left: 0; background: url(../images/sprite.png) no-repeat left center; }
    #focus .next { rightright: 0; background: url(../images/sprite1.png) no-repeat rightright center; }

    js文件
    代码如下:
    $(function () {
    var sWidth = $("#focus").width();
    var len = $("#focus ul li").length;
    var index = 0;
    var picTimer;
    var btn = "";
    for (var i = 0; i < len; i++) {
    btn += "";
    }
    btn += "";
    $("#focus").append(btn);
    $("#focus .btnBg").css("opacity", 0);
    $("#focus .btn span").css("opacity", 0.4).mouseenter(function () {
    index = $("#focus .btn span").index(this);
    showPics(index);
    }).eq(0).trigger("mouseenter");
    $("#focus .preNext").css("opacity", 0.0).hover(function () {
    $(this).stop(true, false).animate({ "opacity": "0.5" }, 300);
    }, function () {
    $(this).stop(true, false).animate({ "opacity": "0" }, 300);
    });
    $("#focus .pre").click(function () {
    index -= 1;
    if (index == -1) { index = len - 1; }
    showPics(index);
    });
    $("#focus .next").click(function () {
    index += 1;
    if (index == len) { index = 0; }
    showPics(index);
    });
    $("#focus ul").css("width", sWidth * (len));
    $("#focus").hover(function () {
    clearInterval(picTimer);
    }, function () {
    picTimer = setInterval(function () {
    showPics(index);
    index++;
    if (index == len) { index = 0; }
    }, 2800);
    }).trigger("mouseleave");
    function showPics(index) {
    var nowLeft = -index * sWidth;
    $("#focus ul").stop(true, false).animate({ "left": nowLeft }, 300);
    $("#focus .btn span").stop(true, false).animate({ "opacity": "0.4" }, 300).eq(index).stop(true, false).animate({ "opacity": "1" }, 300);
    }
    });

    文档

    jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮_jquery

    jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮_jquery:jquery左右滚动焦点图banner图片,鼠标经过显示上下页 适合宽和高都比较大的页面使用 演示 代码如下: 代码如下: @charset utf-8; img { border: 0px; } .bannerbox { width: 320px; height: 150px
    推荐度:
    标签: 左右 滚动 焦点图
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top