﻿jQuery.SliderPic=function(width,height,istitle,style){var _picdiv=$('.ShowPicDiv');_picdiv.css({"width":width,"height":height}).find('img').css({"width":width,"height":height});$('.ShowPicDiv img').each(function(){$(this).attr("src",$(this).attr("data-src"))});if(istitle){_picdiv.after("<div class='ShowPicTitle'></div>");$(".ShowPicTitle").width(width);}var len=$(".ShowPic > li").length;var numHtml="";for(var i=1;i<=len;i++){numHtml+="<li>"+i+"</li>";}$(".ShowPic").after("<ul class='ShowPicNum'>"+numHtml+"</ul>");var index=1;var adTimer;$(".ShowPicNum li").mouseover(function(){showImg($(".ShowPicNum li").index(this),istitle,style);}).eq(0).mouseover();_picdiv.hover(function(){clearInterval(adTimer);},function(){adTimer=setInterval(function(){showImg(index,istitle,style);index++;if(index==len){index=0;}},2500);}).trigger("mouseleave")};function showImg(index,istitle,style){$(".ShowPic").stop(true,false);$(".ShowPicNum li").removeClass("on").eq(index).addClass("on");if(istitle){var nowlink=$(".ShowPic li a").eq(index);$(".ShowPicTitle").html("<a href='"+nowlink.attr("href")+"' target='_blank'>"+nowlink.attr("data-title")+"</a>");}switch(style){case 1:$(".ShowPic").animate({top:-$(".ShowPicDiv").height()*index},500);break;case 2:$(".ShowPic img").fadeOut(300).eq(index).fadeIn(1000);break;case 3:$(".ShowPic img").slideUp(400).eq(index).slideDown(400);break;default:$(".ShowPic img").fadeOut(100).eq(index).fadeIn(500);break;}}
