您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jQuery制作简洁的图片轮播效果_jquery

2024/10/15 17:05:15发布26次查看
演示图:
核心代码:
$(document).ready(function(){ var $ibox = $('.imgbox'), $inum = $('.imgnum'), //缓存优化 indeximg = 1, //初始下标 totalimg = 4, //图片总数量 imgsize = 300, //图片尺寸 宽度 movetime = 1100, //切换动画时间 settime = 2500, //中间暂停时间 clc = null; function moveimg(){ if(indeximg != totalimg){ $ibox.animate({ left: -(indeximg*imgsize) + 'px' }, movetime); $inum.removeclass('mark-color') .eq(indeximg) .addclass('mark-color'); indeximg++; } else{ indeximg = 1; $inum.removeclass('mark-color') .eq(indeximg - 1) .addclass('mark-color'); $ibox.animate({ left: 0 }, movetime); } } $inum.hover(function(){ $ibox.stop(); //结束当前动画 clearinterval(clc); //暂停循环 $inum.removeclass('mark-color'); $(this).addclass('mark-color'); indeximg = $(this).index(); $ibox.animate({ left: -(indeximg*imgsize) + 'px' }, 500); },function(){ clc = setinterval(moveimg, settime); }); clc = setinterval(moveimg, settime);});
以上所述就是本文的全部内容了,希望大家能够喜欢。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product