/* * 说明:$(".hdp_container").om_hdp({delay:300,time:5000,title:1,type:2}); 引用时,.hdp_container容器的宽度和高度即为幻灯片图片的宽和高,参数【delay:动画效果持续时间(毫秒),time:图片切换时间(毫秒),title:显示文字介绍--1不显示--0,type;0为淡入淡出,1为左右滑动】 * 文字介绍直接读取的是图片链接的title值。 */ (function(e){e.fn.om_hdp=function(t){function v(){u==e("li",s).length-1?e("li:eq(0)",s).mouseover():e("li",s).eq(u).next("li").mouseover()}var n={delay:0,time:0,title:0,type:0},r=e.extend({},n,t),s=e(this),o="",u=0,a=s.css("width"),f=s.css("height");r.type==0&&(l=e("img",s).length,e("img",s).css({width:a,height:f,left:"0px",top:"0px",border:"none",display:"none",position:"absolute"}));if(r.type==1){e("img",s).css({width:a,height:f,"float":"left",display:"block",border:"none"}),_content=s.html(),s.html("
"+_content+"
"+_content+"
");var l=e("img",s).length/2,c=parseint(a)*l,p=0;e(".pic_scroll").css({width:c*2+"px",height:f,position:"relative"}),e(".cont").css({width:c+"px",height:f,"float":"left"})}if(r.type==2){e("img",s).css({width:a,height:f,display:"block",border:"none"}),_content=s.html(),s.html("
"+_content+"
"+_content+"
");var l=e("img",s).length/2,d=parseint(f)*l,p=0;e(".pic_scroll").css({width:a,height:d*2+"px",position:"relative"}),e(".cont").css({width:a,height:d+"px"})}s.append("");for(i=1;i"+i+"";e("ul",s).html(o),e("ul",s).css({position:"absolute",padding:"0px",margin:"0px",bottom:"7px",right:"15px","z-index":999}),e("li",s).css({"float":"left",liststyletype:"none",color:"#fcd998",display:"inline",textalign:"center",width:"16px",height:"16px",margintop:"0px",marginright:"3px",marginbottom:"0px",marginleft:"3px",lineheight:"16px",backgroundcolor:"#333333",cursor:"pointer"}),r.title==1&&(s.append("
"),s.append("
"),e(".hdp_bg").css({position:"absolute",width:s.css("width"),height:"30px",bottom:"0px",left:"0px",backgroundcolor:"#000000",opacity:.5,"z-index":50}),e(".hdp_title").css({position:"absolute",width:parseint(s.css("width"))-e("ul",s).width()-80+"px",height:"30px",bottom:"0px",left:"0px",lineheight:"30px",paddingleft:"20px",overflow:"hidden",color:"#fcd998","z-index":50})),e("li",s).live("mouseover",function(){u=e("li",s).index(this),a_curr=e(".con0").find("a").eq(u),r.type==0&&(a_curr=e("a",s).eq(u),e("img",s).is(":animated")&&e("img",s).stop(),a_curr.find("img").fadein(r.delay),a_curr.siblings("a").find("img").fadeout(r.delay)),r.type==1&&(e(".pic_scroll").is(":animated")&&(abs(parseint(e(".pic_scroll").css("left"))%parseint(a))>=parseint(a)/2?e(".pic_scroll").animate({left:"-="+parseint(a)-abs(parseint(e(".pic_scroll").css("left"))%parseint(a))},r.delay):e(".pic_scroll").animate({left:"-="+parseint(a)+abs(parseint(e(".pic_scroll").css("left"))%parseint(a))},r.delay),e(".pic_scroll").stop()),e(".pic_scroll").css("left")=="-"+c+"px"&&e(".pic_scroll").css("left","0px"),e(".pic_scroll").animate({left:"-="+parseint(a)*(u-p)},r.delay),p=u),r.type==2&&(e(".pic_scroll").is(":animated")&&(abs(parseint(e(".pic_scroll").css("top"))%parseint(f))>=parseint(f)/2?e(".pic_scroll").animate({top:"-="+parseint(f)-abs(parseint(e(".pic_scroll").css("top"))%parseint(f))},r.delay):e(".pic_scroll").animate({top:"-="+parseint(f)+abs(parseint(e(".pic_scroll").css("top"))%parseint(f))},r.delay),e(".pic_scroll").stop()),e(".pic_scroll").css("top")=="-"+d+"px"&&e(".pic_scroll").css("top","0px"),e(".pic_scroll").animate({top:"-="+parseint(f)*(u-p)},r.delay),p=u),e(this).addclass("icon_hover").css({color:"#666666",backgroundcolor:"#fcd998",fontweight:"bold"}).siblings().removeclass("icon_hover").css({color:"#fcd998",backgroundcolor:"#333333",fontweight:"bold"}),r.title==1&&(atitle=a_curr.attr("title")=="undefined"?"":a_curr.attr("title"),e(".hdp_title").text(atitle)),clearinterval(h),h=setinterval(v,r.time)}),e("img",s).hover(function(){clearinterval(h)},function(){h=setinterval(v,r.time)}),h=setinterval(v,r.time),e("li:eq(0)",s).mouseover()}})(jquery)