$(function(){ $('#ImgSlide01').doImages({ imgs:$("#ImgSlide01 img"), thumbs:$("#ImgSlide02 >a"), num:0, thumbsClass:"curimg", auto:true, bgObj:$('#zmjsImgSlide-0'), bgColor:['#cad3d9','#c3dcdf','#dfcec3'], time:5000}); }); $.extend($.fn, { doImages: function(options) { var defaults = { imgs: null, thumbs: null, num: 2, thumbsClass: "", auto: false, time: 5000, stat: null, bgObj: null, bgColor: [] }; var opts = $.extend({}, defaults, options), sta = true; if (!opts.thumbs.length) { return } var timers = null; $(opts.thumbs).each(function(index) { $(this).hover(function() { clearTimeout(timers); imgsPlay(index); sta = !1 }, function() { sta = !1; imgsPlay(index); sta = !0 }) }); $(opts.imgs).hover(function() { sta = !1; clearTimeout(timers) }, function() { sta = !0; var _t = this; imgsPlay($(opts.imgs).index(_t)) }); function imgsPlay(obj) { var _this, s; if (!sta) { return } if (typeof obj == "object") { _this = obj; s = $(opts.thumbs).index(_this) } else { s = obj % opts.thumbs.length; _this = opts.thumbs[s] } $(opts.thumbs).removeClass(); $(_this).addClass(opts.thumbsClass); for (var i = 0, ig = opts.imgs, thu = opts.thumbs; i < thu.length; i++) { if (s == i) { $(ig[i]).attr("class", "imgBlock").stop(true, false).css("z-index", "2").fadeTo(500, 1, "linear"); if (opts.bgObj) { opts.bgObj.css({ backgroundColor: opts.bgColor[i] }) } } else { $(ig[i]).css({ display: "block" }).removeClass("imgBlock").css("z-index", "1").stop(true, false).fadeTo(500, 0, "linear") } } if (opts.auto) { timers = setTimeout(function() { if (opts.stat) { opts.stat() } imgsPlay(s) }, opts.time) } if (opts.stat && typeof obj == "object") { opts.stat() } s++ } $(opts.imgs[opts.num]).css({ display: "block", zIndex: "2" }).attr("class", "imgBlock"); $(opts.thumbs[opts.num]).removeClass().addClass(opts.thumbsClass); if (opts.auto) { imgsPlay(opts.num) } } }); $(function(){ $(".con-six").hover(function() { $(this).find(".conimg1").stop().animate({"width":310,"height":370}); }, function() { $(this).find(".conimg1").stop().animate({"width":288,"height":350}); }) $(".con-sss").hover(function() { $(this).find(".conimg2").stop().animate({"width":300,"height":235}); }, function() { $(this).find(".conimg2").stop().animate({"width":273,"height":218}); }) });