// javascript document
(function($){
$.fn.indexscroll=function(options){
var defaults={
auto:true,
dirbtn:true,
minli:1,
animation:"fade", // scroll , fade
spend:1000,
timeout:3000
},
opts=$.extend(defaults,options),
$this=$(this),
lidir=true,
look=true;
init=function(){
if(opts.dirbtn){
var dirbtnhtml='';
if($this.find("li").length>opts.minli){
var dirbtnhtml=""
}
$this.append(dirbtnhtml)
}
}
init();
$this.find('a.scroll-prev').bind('click',function(){
if(!look) return;
clearinterval(timescroll)
lidir=look=false;
choose()
})
$this.find('a.scroll-next').bind('click',function(){
if(!look) return;
clearinterval(timescroll)
look=false;
choose()
})
function fade(){
if(lidir){
var items='
' + $this.find('li:first').html() + '';
$this.find('li:first').fadeout(opts.spend,function(){
$this.find('li:first').remove()
$this.find('ul').append(items)
look=true;
})
}else{
var items='' + $this.find('li:last').html() + '';
$this.find('li:first').fadeout(opts.spend,function(){
$this.find('li:first').show()
$this.find('ul').prepend(items)
$this.find('li:last').remove()
look=lidir=true;
})
}
}
function scroll(){
var w=$this.find('li').outerwidth(),h=$this.find('li').outerheight();
if(lidir){
var items='' + $this.find('li:first').html() + '';
$this.find('ul').animate({'left':"-"+w+"px"},opts.spend,function(){
$this.find('li:first').remove()
$this.find('ul').append(items).css('left',"0px")
look=true;
})
}else{
var items='' + $this.find('li:last').html() + '';
$this.find('ul').prepend(items).css('left',"-"+w+"px")
$this.find('ul').animate({'left':"0px"},opts.spend,function(){
$this.find('li').eq(1).show()
$this.find('li:last').remove()
look=lidir=true;
})
}
}
function choose(){
if($this.find("li").length<=opts.minli) return;
switch(opts.animation){
case "fade":
fade();
break;
case "scroll":
scroll();
break;
}
}
if(opts.auto){
var timescroll=setinterval(choose,opts.timeout)
$this.hover(function(){
clearinterval(timescroll)
},function(){
setinterval(choose,opts.timeout)
})
}
};
//tab 选项卡
$.fn.citystartab=function(option){
var defaults={
hdclass:"citystartab-hd",
bdclass:"citystartab-bd",
hoverclass:"oncurr",
bindevent:"click",
index:0
}
var handle=function(objelem,currindex,classname){
$.each(objelem,function(index,elem){
if(index==currindex){
if(classname){
$(elem).addclass(classname);
}else{
$(elem).css("display","block");
}
}else{
if(classname){
$(elem).removeclass(classname);
}else{
$(elem).css("display","none");
}
}
})
}
var opts=$.extend(defaults,option);
var $hditems=$(this).find("."+opts.hdclass);
var $bditems=this.find("."+opts.bdclass);
$hditems.eq(0).addclass(opts.hoverclass);
$bditems.eq(0).css("display","block");
if($hditems.length!=$bditems.length) return false;
$hditems.each(function(){
$(this).bind(opts.bindevent,function(){
opts.index=$hditems.index(this);
handle($hditems,opts.index,opts.hoverclass);
handle($bditems,opts.index);
})
})
};
})(jquery);
//banner 的js
(function($){
$.fn.bannerslider=function(options){
var defaults={
width:950,
height:355,
auto:true,
effect:"slider",
pause:3000,
animtime:250,
zindex:10,
parentclass:"cs-bannerwrap",
pagination:{
show:true,
evttype:"click",
classname:"banner-numlist"
},
btn:{
show:true,
dynamic:true
},
describe:{
show:true,
left:0,
bottom:0
}
};
var opts=$.extend(true,defaults,options),$this=this;
var index=0,
$this=this,
len,
islock=false,
animdir=1,
timer=null,
isfirst=true,
effectarray=["slider","fade"],
isie6=!-[1,]&&!window.xmlhttprequest,
animationway;
var $prevbtn,$nextbtn,$pagination,$pagination_lis,$slider_lis,$parent,$describe;
$slider_lis=this.children("li");
$parent=this.parent();
len=$slider_lis.length;
//传进来的效果
function getanimway(effect){
try{
if(effect.constructor !==string){
throw new error(effect+"must be string");
}else{
var index=$.inarray(effect,effectarray)
if(index >=0){
animwayinit(effect);
return effect;
}else{
alert(effect +" effects is not defined in the plugin");
return false;
}
}
}catch(e){
alert(e.message)
}
};
function animwayinit(effect){
if(effect==effectarray[0]){
$slider_lis.css("position","absolute").eq(index).css({zindex:opts.zindex,display:"block"}).siblings().css({zindex:opts.zindex-1}).hide();
}else if(effect==effectarray[1]){
$slider_lis.css({position:"absolute",opacity:0,zindex:opts.zindex-1}).eq(index).css("zindex",opts.index).animate({"opacity":1});
if(isie6){
$slider_lis.css("display","none").eq(index).css("display","block")
}
}
}
function btninit(){
if(opts.btn.show){
$prevbtn=$('');
$nextbtn=$('');
$prevbtn.css("zindex",opts.zindex+1).addclass("banner-ui-prev");
$nextbtn.css("zindex",opts.zindex+1).addclass("banner-ui-next");
$prevbtn.appendto($parent);
$nextbtn.appendto($parent);
if(opts.btn.dynamic){
$prevbtn.hide();
$nextbtn.hide();
}else{
$prevbtn.show();
$nextbtn.show();
}
$prevbtn.bind("mouseover",thismouseover).bind("mouseout",thismouseout).bind("click",prevbtnscroll);
$nextbtn.bind("mouseover",thismouseover).bind("mouseout",thismouseout).bind("click",nextbtnscroll);
}
};
function thismouseover(event){
cleartimeout(timer);
var relateelem = event.relatedtarget;
if($(relateelem).closest($parent).length > 0){
return;
}else{
if(opts.btn.dynamic){
$prevbtn.stop(false,true).fadein();
$nextbtn.stop(false,true).fadein();
}
islock=true;
animdir=1;
}
};
function thismouseout(event){
var relateelem = event.relatedtarget;
if($(relateelem).closest($parent).length > 0){
return;
}else{
if(opts.btn.dynamic){
$prevbtn.stop(false,true).fadeout();
$nextbtn.stop(false,true).fadeout();
}
islock=false;
isfirst=true;
animdir=1;
beginstart()
}
}
function prevbtnscroll(){
if(!$this.is(":animated")){
cleartimeout(timer)
index--;
animdir=0;
beginstart();
}
return false;
}
function nextbtnscroll(){
if(!$this.is(":animated")){
cleartimeout(timer)
index++;
animdir=1;
beginstart()
}
return false;
}
function paginationinit(){
var strlis="";
if(opts.pagination.show){
if(len > 1){
$pagination=$('');
$pagination.addclass(opts.pagination.classname).css({"zindex":opts.zindex+1,"position":"absolute"})
for(var i=0;i"+(i+1)+"";
}
$pagination.append(strlis);
$pagination.appendto($parent)
$pagination_lis=$pagination.find("li");
$pagination_lis.eq(index).addclass("oncurr");
$pagination_lis.each(function(){
$(this).bind(opts.pagination.evttype,paginationevt);
$(this).bind("mouseover",thismouseover).bind("mouseout",thismouseout);
})
}
}
};
function paginationevt(){
var previndex=index;
islock=true;
cleartimeout(timer);
index=$pagination_lis.index(this);
if(previndex < index){
animdir=1;
beginstart()
}else if(previndex > index){
animdir=0;
beginstart()
}else{
return
}
}
function descinit(){
if(opts.describe.show){
$describe=$('');
$describe.appendto($parent).css({zindex:opts.zindex+1,position:"absolute",left:opts.describe.left,bottom:opts.describe.bottom});
if($.trim($slider_lis.eq(index).attr("data-title"))==""){
$describe.hide()
}else{
$describe.text($slider_lis.eq(index).attr("data-title"));
}
$describe.bind("mouseout",thismouseout)
}
};
function switchanimdir(animdir,animationway){
if(animationway=="slider"){
var childrenanimw=null,parentanimw=null;
switch(animdir){
case 0://左按钮
childrenanimw=-opts.width;//子元素右移
parentanimw=opts.width;//父元素左移动
slidescroll(childrenanimw,parentanimw);
break;
case 1://右按钮
childrenanimw=opts.width;
parentanimw=-opts.width;
slidescroll(childrenanimw,parentanimw)
break;
}
}else if(animationway=="fade"){
$slider_lis.css("zindex",opts.zindex-1).stop(true).animate({opacity:0}).eq(index).css("zindex",opts.zindex).stop(true).animate({opacity:1});
if(isie6){
$slider_lis.css("display","none").eq(index).css("display","block")
}
}
};
function slidescroll(childrenanimw,parentanimw){
$slider_lis.eq(index).css({left:childrenanimw,zindex:opts.zindex,display:"block"});
$this.stop(false,true).animate({left:parentanimw},opts.animtime,function(){
$slider_lis.eq(index).css("left",0).siblings().css({zindex:opts.zindex-1,display:"none"});
$(this).css("left",0);
})
};
function beginstart(){
if(index < 0){
index=len-1;
}else if(index==len){
index=0
}
scrolling();
};
function scrolling(){
if(isfirst){
isfirst=false
}else{
switchanimdir(animdir,animationway)
if(opts.pagination.show){
$pagination_lis.eq(index).addclass("oncurr").siblings().removeclass("oncurr")
}
}
if(opts.describe.show){
if($.trim($slider_lis.eq(index).attr("data-title"))==""){
$describe.fadeout();
}else{
$describe.text($slider_lis.eq(index).attr("data-title")).fadein()
}
}
if(!islock && opts.auto){
timer=settimeout(function(){index++;beginstart();},opts.pause)
}
};
var init=function(){
//初始化父元素
$parent.addclass(opts.parentclass).css({width:opts.width,height:opts.height,position:"relative",overflow:"hidden",margin:"0 auto"});
//初始化ul
$this.css({width:opts.width,height:opts.height,position:"relative"});
//获取效果的方式
if(len > 1){
animationway=getanimway(opts.effect);
btninit();
paginationinit();
descinit();
$this.bind("mouseover",thismouseover);
$this.bind("mouseout",thismouseout);
beginstart()
}
};
init();
}
})(jquery);
(function($){
$.fn.staffgallery=function(option){
var defaultsid={
bigprevid:"j_staff-bigprev",
bignextid:"j_staff-bignext",
bigpictitid:"j_staff-bigpictit",
bigpictxtid:"j_staff-bigpictxt",
smalllistwrapid:"j_staff-smalllistwrap",
containerid:"j_staff-conbox"
}
$.fn.staffgallery.defaults = {
smallprevid:"j_staff-smallprev",
smallnextid:"j_staff-smallnext",
smalllistinnerid:"j_staff-smalllistinner",
smalldisprevclass:"staff-dis-smallprev",
smalldisnextclass:"staff-dis-smallnext",
smalldataclass:"staff-smallitem",
smallwrapid:"j_staff-smallwrap",
bigpictitclass:"staff-bigpictit",
arrowid:"j_staff-arrow",
bigpicwrapid:"j_staff-bigwrap",
bigprevclass:"staff-bigprev",
bignextclass:"staff-bignext",
bigpicwrapw:666,
bigpicwraph:483,
fixlen:4,//第几张固定
viewlen:6,//滚动可见的长度
arrowh:35,
scrow:103,
dir:"left",
istitshow:true,
isbigbtnshow:true //是否显示标题
}
var opts = $.extend(defaultsid, $.fn.staffgallery.defaults, option);
var index=0,
$smallprev=$("#"+opts.smallprevid),
$smallnext=$("#"+opts.smallnextid),
$container=$("#"+opts.containerid),
$smalllistinner=$("#"+opts.smalllistinnerid),
$arrow=$("#"+opts.arrowid),
$bigpicwrap=$("#"+opts.bigpicwrapid);
$smalllistwrap=$("#"+opts.smalllistwrapid);
$smallwrap=$("#"+opts.smallwrapid)
var nextdistance=opts.viewlen-opts.fixlen,
$smalldataitems=$smalllistinner.find("."+opts.smalldataclass);
totallen=$smalldataitems.length;
var bigsrc,
bigtit,
$bigpictit,
$bignext,
$bigprev,
$bigpictit,
$bigpictxt,
$this=this;
//获取图片信息和操作图片函数
var changebigimg=function(currindex){
bigsrc=$smalldataitems.eq(currindex).attr("href");
bigtit=$smalldataitems.eq(currindex).attr("data-title");
$this.stop(false,true).fadeout(200,function(){
$this.attr("src",bigsrc).fadein()
});
if(opts.istitshow){
$bigpictit.animate({top:opts.bigpicwraph},200,function(){
if($.trim(bigtit) !=""){
$bigpictxt.text(bigtit);
$bigpictit.show();
}else{
$bigpictit.hide();
}
$bigpictit.stop(false,true).animate({top:opts.bigpicwraph-opts.arrowh})
})
}
};
//初始化
var init=function(){
if(opts.dir=="left"){
$smallwrap.css({width:opts.bigpicwrapw,overflow:"hidden"});
}
$this.parent().css({width:opts.bigpicwrapw-2,height:opts.bigpicwraph-2,overflow:"hidden"})
if (totallen == 1) {
$smallwrap.hide();
}
$bigpicwrap.css({width:opts.bigpicwrapw,height:opts.bigpicwraph,overflow:"hidden",position:"relative"})
bigsrc=$smalldataitems.eq(index).attr("href");
bigtit=$smalldataitems.eq(index).attr("data-title");
$this.attr("src",bigsrc);
if(opts.istitshow){//如果显示标题的话
var $bigpictxtdom=$('
')
$bigpictxtdom.appendto($bigpicwrap);
$bigpictit=$("#"+opts.bigpictitid);
$bigpictxt=$("#"+opts.bigpictxtid);
$bigpictit.css({top:opts.bigpicwraph-opts.arrowh}).hide();
changebigimg(index)
}
if(opts.isbigbtnshow){//如果显示大图按钮的话
var $bigprevbtn=$("");
var $bignextbtn=$("");
$bigprevbtn.appendto($bigpicwrap);
$bignextbtn.appendto($bigpicwrap);
}
$smallprev.eq(index).addclass(opts.smalldisprevclass);
if(totallen <= opts.viewlen){
}else{
if(opts.dir=="left"){
$smalllistinner.width(totallen*opts.scrow)
}else{
$smalllistinner.height(totallen*opts.scrow)
}
}
$smalllistinner.css({"position":"absolute","overflow":"hidden"});
if(opts.dir=="left"){
$smalllistwrap.css({"width":opts.viewlen*opts.scrow,"position":"relative","overflow":"hidden"});
}else{
$smalllistwrap.css({"height":opts.viewlen*opts.scrow,"position":"relative","overflow":"hidden"});
}
};
init()
//处理index 范围的函数
var slideindexchange=function(currindex,dir){
if(dir=="left"){
if(totallen =0 && currindex <=opts.fixlen-1){//0-3
$arrow.stop(false,true).animate({left:currindex*opts.scrow},200);
$smalllistinner.animate({left:0*opts.scrow})
}else if(currindex >(opts.fixlen-1) && currindex <(totallen-nextdistance)){//4
$arrow.stop(false,true).animate({left:(opts.fixlen-1)*opts.scrow},200);
$smalllistinner.animate({left:-(currindex-opts.fixlen+1)*opts.scrow})
}else if(currindex >=(totallen-nextdistance)){//5-7
$arrow.stop(false,true).animate({left:(opts.viewlen-(totallen-currindex))*opts.scrow},200);
$smalllistinner.animate({left:-(totallen-opts.viewlen)*opts.scrow})
}
}
}else if(dir=="top"){
if(totallen =0 && currindex <=opts.fixlen-1){//0-3
$arrow.stop(false,true).animate({top:currindex*opts.scrow},200);
$smalllistinner.animate({top:0*opts.scrow})
}else if(currindex >(opts.fixlen-1) && currindex <(totallen-nextdistance)){//4
$arrow.stop(false,true).animate({top:(opts.fixlen-1)*opts.scrow},200);
$smalllistinner.animate({top:-(currindex-opts.fixlen+1)*opts.scrow})
}else if(currindex >=(totallen-nextdistance)){//5-7
$arrow.stop(false,true).animate({top:(opts.viewlen-(totallen-currindex))*opts.scrow},200);
$smalllistinner.animate({top:-(totallen-opts.viewlen)*opts.scrow})
}
}
}
}
//单击prev按钮的事件函数
var prevbtnhander=function(currindex){
if(currindex !=totallen-1){
$smallnext.removeclass(opts.smalldisnextclass);
}
if(currindex==0){
$smallprev.addclass(opts.smalldisprevclass);
}
slideindexchange(index,opts.dir);
changebigimg(index)
};
//单击next按钮的事件函数
var nextbtnhander=function(currindex){
if(index !=0){
$smallprev.removeclass(opts.smalldisprevclass);
}
if(index==(totallen-1)){
$smallnext.addclass(opts.smalldisnextclass)
}
if(index <=opts.fixlen-1){
if(opts.dir=="left"){
$arrow.stop(false,true).animate({left:"+="+opts.scrow},200)
}else{
$arrow.stop(false,true).animate({top:"+="+opts.scrow},200)
}
}else{
if((totallen-index-nextdistance)<=0){
if(opts.dir=="left"){
$arrow.stop(false,true).animate({left:"+="+opts.scrow},200);
}else{
$arrow.stop(false,true).animate({top:"+="+opts.scrow},200);
}
}else{
if(opts.dir=="left"){
$smalllistinner.animate({left:-(index-opts.fixlen+1)*opts.scrow})
}else{
$smalllistinner.animate({top:-(index-opts.fixlen+1)*opts.scrow})
}
}
}
changebigimg(index)
};
//单击小图的左按钮
$smallprev.bind("click",function(){
if(index==0){ return false}
index--;
prevbtnhander(index)
return false
});
//单击小图的右按钮
$smallnext.bind("click",function(){
if(index==(totallen-1)){return false}
index++;
nextbtnhander(index);
return false;
});
$smalldataitems.each(function(){
$(this).bind("click",function(){
var lastindex=index
index=$smalldataitems.index(this);
if(index==0){$smallprev.addclass(opts.smalldisprevclass);}
if(index==totallen-1){$smallnext.addclass(opts.smalldisnextclass)}
if(index!=0){$smallprev.removeclass(opts.smalldisprevclass);}
if(index!=totallen-1){$smallnext.removeclass(opts.smalldisnextclass)}
var distanceindex=math.abs(lastindex-index);
changebigimg(index);
slideindexchange(index,opts.dir);
return false;
})
})
if(opts.isbigbtnshow && totallen !=1){
$bignext=$("#"+opts.bignextid);
var bignexth=$bignext.height();
$bigprev=$("#"+opts.bigprevid);
var bigprevh=$bigprev.height();
$bignext.css("top",(opts.bigpicwraph-bignexth)/2);
$bigprev.css("top",(opts.bigpicwraph-bigprevh)/2)
//单击大图的右按钮
$bignext.bind("click",function(){
index++;
if(index !=0){$bigprev.show();}
if(index==totallen-1){$(this).hide()}
nextbtnhander(index)
return false;
})
//单击大图的左按钮
$bigprev.bind("click",function(){
index--;
if(index !=totallen-1){$bignext.show();}
if(index==0){$(this).hide()}
prevbtnhander(index);
return false
});
//大图 $bigwrap hover的时候的效果
$bigpicwrap.bind("mouseover",function(event){
var relateelem = event.relatedtarget;
if($(relateelem).closest($bigpicwrap).length > 0){
return;
}else{
if(index==totallen-1){
$bigprev.stop(false,true).fadein();
}else if(index==0){
$bignext.stop(false,true).fadein()
}else{
$bigprev.stop(false,true).fadein();
$bignext.stop(false,true).fadein()
}
}
}).bind("mouseout",function(event){
var relateelem = event.relatedtarget;
if($(relateelem).closest($bigpicwrap).length > 0){
return;
}else{
$bigprev.stop(false,true).fadeout();
$bignext.stop(false,true).fadeout()
}
});
}
}
})(jquery);
//头部导航
(function($){
$.fn.csmenu=function(options){
var defaults={
maxwidth:980,
align:"left",
isfloat:false,
subnavclass:"nav-sub",
hoverclass:"onhover",
navwrapid:"j_navwrap",
arroww:38,
zindex:20,
pushmenudownby:36
}
var opts=$.extend(defaults,options);
var $navwrap=$("#"+opts.navwrapid),$this=this,$child_lis,$subnav,index,isfirst=true;
function binddata(navsubw,elem,elemw,postop,posleft,$navsub){
var arrowleft=null;
if(elemw > navsubw){navsubw=elemw};
if(navsubw > opts.maxwidth){navsubw=opts.maxwidth;}
var floatnavleft=null;
var pos_c_l=posleft+elemw/2;
var pos_c_r=opts.maxwidth-(posleft+elemw/2);
var pos_l_r=opts.maxwidth-posleft;
if(opts.isfloat){
if($navsub.find("li").length==1){
$navsub.addclass("nav-subsingle");
}
}
if(navsubw > opts.maxwidth){
arrowleft=posleft+(elemw-opts.arroww)/2;
floatnavleft=0;
$navsub.addclass("center")
}else{
if(opts.align=="center"){
if(pos_c_l < navsubw/2){
//如果li的中心到达左岸的距离小于"子导航"的一半
if(pos_l_r >= navsubw){//如果li的左边到右岸的距离 大于navsubw的时候,左对齐
arrowleft=(elemw-opts.arroww)/2;
floatnavleft=posleft;
$navsub.addclass("left");
}else if(pos_l_r < navsubw){//如果li的左边到右岸的距离 大于navsubw的时候,左岸对其
arrowleft=posleft+(elemw-opts.arroww)/2;
floatnavleft=0;
$navsub.addclass("center");
}
}else if(pos_c_l >= navsubw/2){
//如果li的中心到达左岸的距离大于等于"子导航"的一半
if(pos_c_r >= navsubw/2){
//如果li的中心到右岸的距离 大于navsubw一半的时候,剧中
arrowleft=(navsubw-opts.arroww)/2;
floatnavleft=posleft-(navsubw-elemw)/2;
$navsub.addclass("center");
}else if(pos_c_r < navsubw/2){
//如果li的中心到右岸的距离 小于navsubw一半的时候,直接右对齐
if(pos_c_l < navsubw){
arrowleft=pos_c_l;
floatnavleft=0;
$navsub.addclass("center");
}else{
arrowleft=navsubw-(elemw+opts.arroww)/2;
floatnavleft=posleft+elemw-navsubw;
$navsub.addclass("right");
}
}
}
}else if(opts.align=="left"){
if(navsubw <=elemw){
arrowleft=navsubw-(elemw+opts.arroww)/2;
floatnavleft=posleft;
$navsub.addclass("center");
}else{
if(pos_l_r < navsubw){//右对齐
arrowleft=navsubw-(elemw+opts.arroww)/2;
floatnavleft=posleft+elemw-navsubw;
$navsub.addclass("right");
}else if(pos_l_r >=navsubw){//左对齐
arrowleft=(elemw-opts.arroww)/2;
floatnavleft=posleft;
$navsub.addclass("left");
}
}
}
}
elem.data({"posleft":floatnavleft,"arrowleft":arrowleft,"floatnavw":navsubw});
}
var floatmenuobj=(function(){
var $floatmenubox=$("");
$floatmenubox.css({zindex:opts.zindex+1,top:opts.pushmenudownby})
var $floatarrow=$("");
var $floacontextbox=$("");
$floatmenubox.css("top",opts.pushmenudownby);
$floatmenubox.append($floatarrow).append($floacontextbox);
$navwrap.append($floatmenubox);
return {"self":$floatmenubox,"arrow":$floatarrow,"contentbox":$floacontextbox};
})()
var init=function(){
$navwrap.css("zindex",opts.zindex);
$child_lis=$this.children("li");
$child_lis.last().addclass("last")
$.each($child_lis,function(index,elem){
var $elem=$(elem);
var $navsub=$elem.find("."+opts.subnavclass).eq(0);
var navsubw=$navsub.width();
var postop=$elem.position().top;
var posleft=$elem.position().left;
var elemw=$elem.outerwidth();
binddata(navsubw,$elem,elemw,postop,posleft,$navsub);
if($elem.find("li").length > 0){
$elem.find("li").last().addclass("last");
$elem.bind("mouseenter",function(event){
index=$child_lis.index(this);
var relatetarget=event.relatedtarget;
//if($(relatetarget).closest(floatmenuobj.self).length > 0){return false}
floatmenuobj.self.width($(this).data("floatnavw"));
$(this).addclass(opts.hoverclass);
floatmenuobj.contentbox.empty().append($navsub.clone()); floatmenuobj.arrow.css({left:$(this).data("arrowleft")});
floatmenuobj.self.stop(true,true).css("left",$(this).data("posleft")).fadein();
}).bind("mouseleave",function(event){
var relatetarget=event.relatedtarget;
if($(relatetarget).closest(floatmenuobj.self).length > 0){
return
}else{
$(this).removeclass(opts.hoverclass);
floatmenuobj.self.fadeout()
}
})
}else{
$elem.bind("mouseover",function(event){
floatmenuobj.self.stop(true,true).fadeout();
})
}
})
};
init();
floatmenuobj.self.bind("mouseleave",function(event){
var relatetarget=event.relatedtarget;
if($(relatetarget).closest($child_lis.eq(index)).length > 0){
return;
}else{
$child_lis.eq(index).removeclass(opts.hoverclass)
floatmenuobj.self.stop(true,true).fadeout()
/* var relatetarget=relatetarget.tagname=="li" ? relatetarget : relatetarget.parentnode;
$child_lis.eq(index).removeclass(opts.hoverclass);
index=$child_lis.index(relatetarget);
$navsub=$child_lis.eq(index).find("."+opts.subnavclass).eq(0);
floatmenuobj.contentbox.empty().append($navsub.clone()); floatmenuobj.arrow.css({left:$child_lis.eq(index).data("arrowleft")});
floatmenuobj.self.stop(true,true).css({left:$child_lis.eq(index).data("posleft")}).fadein(); */
}
})
}
})(jquery)
//二维码
;(function($){
$.fn.ewm=function(){
$("#j_header-ewm").hover(function(){
$(this).find(".ewm-bd").stop(false,true).fadein();
$(this).find(".ewm-hd").addclass("oncurr");
},function(){
$(this).removeclass("oncurr").find(".ewm-bd").stop(false,true).fadeout();
$(this).find(".ewm-hd").removeclass("oncurr");
})
}
})(jquery)
;(function($){
$.fn.sidebarnav=function(options){
var defaults={
subhoverclass:"onhover",
subnavclass:"sidebar-subnav"
}
var opts=$.extend(defaults,options);
var mouseover_timerarr=[],mouseout_timerarr=[];
var $children_lis=this.children("li");
$.each($children_lis,function(index,elem){
$(elem).find("."+opts.subnavclass).children("li").last().addclass("last");
if($(elem).find(".suboncurr").length > 0){
$(elem).addclass("oncurr");
}
if($(elem).find("li").length > 0 && !$(elem).hasclass("oncurr")){
$(elem).hover(function(){
var $this=$(this);
$this.addclass(opts.subhoverclass);
cleartimeout(mouseout_timerarr[index]);
mouseover_timerarr[index] = settimeout(function() {$this.find('.'+opts.subnavclass).eq(0).slidedown(150);},155);
},function(){
var $this =$(this);
$this.removeclass(opts.subhoverclass);
cleartimeout(mouseover_timerarr[index]);
mouseout_timerarr[index] = settimeout(function() {$this.find('.'+opts.subnavclass).eq(0).slideup(150);},155)
})
}
})
}
})(jquery);
//广告
;(function($){
$.fn.csadvert=function(options){
var opts=$.extend({},$.fn.csadvert.defaults,options);
return this.each(function(){
var $this=$(this),
isstop=false,
index=0,
$parent2=$this.parent().parent().eq(0),
$parent1=$this.parent(),
adwidth,
adheight,
timer=null,
$pagination,
$pagination_lis,
isie6=!-[1,]&&!window.xmlhttprequest,
$slider_lis=$this.children("li"),
len=$slider_lis.length,
$pagination;
adwidth=$parent2.width()
adheight=$parent2.height()
var paginationinit=function(){
var strlis="";
$pagination=$('');
$pagination.addclass("advert-numlist").css({"zindex":opts.zindex+1,"position":"absolute"})
for(var i=0;i"+(i+1)+"";
}
$pagination.append(strlis);
$pagination.appendto($parent1)
$pagination_lis=$pagination.find("li");
$pagination_lis.eq(index).addclass("oncurr");
$pagination_lis.each(function(){
$(this).bind("mouseover",paginationevt);
$(this).bind("mouseover",thismouseover).bind("mouseout",thismouseout);
})
};
function paginationevt(){
var previndex=index;
isstop=true;
cleartimeout(timer);
index=$pagination_lis.index(this);
beginstart()
}
function thismouseover(event){
cleartimeout(timer);
var relateelem = event.relatedtarget;
if($(relateelem).closest($parent1).length > 0){
return;
}else{
isstop=true;
}
};
function thismouseout(event){
var relateelem = event.relatedtarget;
if($(relateelem).closest($parent1).length > 0){
return;
}else{
isstop=false;
beginstart()
}
};
function beginstart(){
if(index < 0){
index=len-1;
}else if(index==len){
index=0
}
scrolling();
};
function scrolling(){
$slider_lis.css("zindex",opts.zindex-1).stop(true).animate({opacity:0}).eq(index).css("zindex",opts.zindex).stop(true).animate({opacity:1});
if(opts.pagination){
$pagination_lis.eq(index).addclass("oncurr").siblings().removeclass("oncurr")}
if(isie6){
$slider_lis.css("display","none").eq(index).css("display","block")
}
if(!isstop){
timer=settimeout(function(){index++;beginstart();},3000)
}
};
var init=function(){
$parent1.css({position:"relative",width:adwidth,height:adheight,"overflow":"hidden"});
$slider_lis.css({position:"absolute",opacity:0,zindex:opts.zindex-1,left:"0",top:"0"}).eq(index).css("zindex",opts.index).animate({"opacity":1});
if(isie6){
$slider_lis.css("display","none").eq(index).css("display","block")
}
$this.bind("mouseover",thismouseover);
$this.bind("mouseout",thismouseout);
if(opts.pagination){
paginationinit() ;
$pagination.bind("mouseover",thismouseover);
$pagination.bind("mouseout",thismouseout);
}
beginstart()
}
init();
})
}
$.fn.csadvert.defaults={
index:10,
pagination:true
}
})(jquery)
;(function($){
$.fn.proscroll=function(options){
var opts = $.extend({},$.fn.proscroll.defaults, options);
return this.each(function(){
var $this=$(this),len,$children_lis,li_w,isfull=true,$prev,$next,$thisparent,thisw,timer;
var each_opts = $.meta ? $.extend({}, opts, $this.data()) : opts;
var init=function(){
$thisparent=$this.parent();
$children_lis=$this.children("li");
li_w=$children_lis.eq(0).outerwidth(true);
len=$children_lis.length;
if(len <=each_opts.len){
isfull=false
len=each_opts.len;
return;
}
thisw=len*li_w;
$this.css("width",thisw)
$thisparent.css({width:thisw*2,left:-thisw});
if(isfull){
var thisclone=$this.clone(true);
thisclone.appendto($thisparent);
$prev=$('');
$next=$('');
$prev.appendto($thisparent.parent());
$next.appendto($thisparent.parent());
$prev.bind("click",function(){
if($this.is(":animated")){ return}
$thisparent.stop(false,true).animate({left:"+="+li_w},each_opts.animtime,function(){
if(math.abs(parseint($thisparent.css("left")))==0){
$thisparent.css("left",-thisw)
}
})
return false
});
$next.bind("click",function(){
if($this.is(":animated")){return}
$thisparent.stop(false,true).animate({left:"-="+li_w},each_opts.animtime,function(){
if(math.abs(parseint($thisparent.css("left")))==2*thisw-(each_opts.len*li_w)){
$thisparent.css("left",-(len-each_opts.len)*li_w)
}
})
return false
});
$thisparent.parent().bind("mouseenter",function(event){
$prev.stop(false,true).fadein();
$next.stop(false,true).fadein();
}).bind("mouseleave",function(event){
$prev.stop(false,true).fadeout();
$next.stop(false,true).fadeout();
})
}
}
init();
});
$.fn.proscroll.defaults={
len:3,
animtime:300
};
}
})(jquery)
$(function(){$(".h-pro-list").proscroll({len:4,animtime:300});})