最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

jquery图片新闻多组图片轮播

来源:http://www.erdangjiade.com/ 沐浴春风 2016-08-02 07:20浏览(1809)

jQuery点击缩略图切换大图,缩略图若是很多的话,支持分页,左右按钮滚动,点击大图左右按钮,到一定数量,缩略图会跟着滚动。

0、请不要问“在不在”之类的问题,有问题直接问!1、学生或暂时没有工作的童鞋,整站资源免费下载!2、¥9.9充值终身VIP会员,加我微信,826096331 拉你进VIP群学习!3、程序员加油,技术改变世界。在线 充值

jquery图片新闻多组图片轮播
分类:图片代码 > 图片轮播 难易:中级
查看演示

加我微信,拉你进VIP群学习:

下载资源 下载积分: 30 积分
//mouseover效果
function liMouseOn() {
    $(".scrolltab .ulBigPic li").attr("class", "");
    for (var i = 0; i < $(".scrolltab .ulBigPic li").length; i++) {
        (function(j) {
            $(".scrolltab .ulBigPic li:eq(" + j + ")").mouseover(function() {
                if ($(".scrolltab").attr("class") == "dSmallList" || $(".scrolltab").attr("class") == "dMiddleList") {
                    if ($(this).attr("class") != "liSelected") {
                        $(this).attr("class", "liSelected");
                    }
                }
            });
            $(".scrolltab .ulBigPic li:eq(" + j + ")").mouseout(function() {
                if ($(".scrolltab").attr("class") == "dSmallList" || $(".scrolltab").attr("class") == "dMiddleList") {
                    if ($(this).attr("class") == "liSelected") {
                        $(this).attr("class", "");
                    }
                }
            });
        })(i);
    }
}

//定义当前、之前、之后要显示图片的排位
var curPic = 0, nextPic = -1, prePic = -1;
preShowPic = -1;
var allPic = $(".scrolltab .ulBigPic li").length;
//初始化当前、之前、之后要显示图片的排位

function numInit(num) {
    if (num == "init") {
        if (allPic > 1) {
            nextPic = curPic + 1;
            prePic = allPic - 1;
        } else if (allPic == 1) {
            nextPic = 0;
            prePic = 0;
        }
        $(".scrolltab .ulBigPic li:eq(" + curPic + ")").attr("class", "liSelected");
    } else if (num == "plus") {
        preShowPic = curPic;
        prePic = curPic;
        curPic = nextPic;
        if (curPic < (allPic - 1)) {
            nextPic = curPic + 1;
        } else if (curPic == (allPic - 1)) {
            nextPic = 0;
        }
        $(".scrolltab .ulBigPic li:eq(" + curPic + ")").attr("class", "liSelected");
        if (preShowPic != curPic) {
            $(".scrolltab .ulBigPic li:eq(" + preShowPic + ")").attr("class", "");
        }
    } else if (num == "minus") {
        preShowPic = curPic;
        nextPic = curPic;
        curPic = prePic;
        if (curPic > 0) {
            prePic = curPic - 1;
        } else if (curPic == 0 && allPic > 1) {
            prePic = allPic - 1;
        }
        $(".scrolltab .ulBigPic li:eq(" + curPic + ")").attr("class", "liSelected");
        if (preShowPic != curPic) {
            $(".scrolltab .ulBigPic li:eq(" + preShowPic + ")").attr("class", "");
        }
    } else {
        preShowPic = curPic;
        curPic = num;
        if (curPic == (allPic - 1)) {
            nextPic = 0;
            if (allPic > 1) {
                prePic = curPic - 1;
            } else if (allPic == 1) {
                prePic = 0;
            }
        } else if (curPic == 0) {
            prePic = allPic - 1;
            if (allPic > 1) {
                nextPic = 1;
            } else if (allPic == 1) {
                nextPic = 0;
            }
        } else {
            nextPic = curPic + 1;
            prePic = curPic - 1;
        }
        $(".scrolltab .ulBigPic li:eq(" + curPic + ")").attr("class", "liSelected");
        if (preShowPic != curPic) {
            $(".scrolltab .ulBigPic li:eq(" + preShowPic + ")").attr("class", "");
        }
    }
    //alert("curPic="+curPic+"/nextPic="+nextPic+"/prePic="+prePic+"/preShowPic="+preShowPic);
}

//大图左右按钮初始化
function btnAInit() {
    if (allPic < 2) {
        $("#sLeftBtnA").attr("class", "sLeftBtnABan");
        $("#sRightBtnA").attr("class", "sRightBtnABan");
    } else {
        if (curPic == 0) {
            $("#sLeftBtnA").attr("class", "sLeftBtnABan");
            $("#sRightBtnA").attr("class", "sRightBtnA");
        } else if (curPic == (allPic - 1)) {
            $("#sLeftBtnA").attr("class", "sLeftBtnA");
            $("#sRightBtnA").attr("class", "sRightBtnABan");
        } else {
            $("#sLeftBtnA").attr("class", "sLeftBtnA");
            $("#sRightBtnA").attr("class", "sRightBtnA");
        }
    }
}

//小图左右按钮初始化
function btnBInitA() {
    if (allPic > 6) {
        $("#sRightBtnB").attr("class", "sRightBtnB");
    }
}
声明:本文为原创文章,如需转载,请注明来源erdangjiade.com并保留原文链接:https://www.erdangjiade.com/js/920.html
评论2
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

  • 头像 椅子
    06-11 19:38
    ngu137
    功能不错啊,美女漂亮啊。。哈哈
  • 头像 沙发
    03-01 21:11
    hanwen
    很好的资源,真心不错的资源
1 2