$(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}); }) });