首页 > 其他 > 详细

遍历输出图片加hover

时间:2017-05-22 17:22:35      阅读:210      评论:0      收藏:0      [点我收藏+]

1.

$(".icon a>div").hover(function () {
            var slls = $(this).attr("class");
            slls = slls.replace("hi", "");
            $(this).css({ "background": "url(<%=site.path.themepath %>images/hicon" + slls + "h.jpg) no-repeat center #fff" });

         }, function () {
             var slls = $(this).attr("class");
             slls = slls.replace("hi", "");
             $(this).css({ "background": "url(<%=site.path.themepath %>images/hicon" + slls + ".jpg) no-repeat center #fff" });
        });

2.

for (var i = 1; i < 6; i++) {
            $(".icon a:eq(" + (i - 1) + ")>div").css({ "background": "url(<%=site.path.themepath %>images/hicon" + i + ".jpg) no-repeat center #fff" });
        }
        var iconhover = new Array(1, 2, 3, 4, 5);
        for (var j = 0; j < 5; j++) {
            $(".icon a:eq(" +j+ ")>div").hover(function () {
                var slls = $(this).attr("class");
                slls = slls.replace("hi", "");
                $(this).css({ "background": "url(<%=site.path.themepath %>images/hicon" + slls + "h.jpg) no-repeat center #fff" });

            }, function () {
                var slls = $(this).attr("class");
                slls = slls.replace("hi", "");
                $(this).css({ "background": "url(<%=site.path.themepath %>images/hicon" + slls + ".jpg) no-repeat center #fff" });
            });
        
        
        }
    });
  

 技术分享

 

遍历输出图片加hover

原文:http://www.cnblogs.com/LLMjiayou7/p/6890361.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!