You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
13 KiB
JavaScript
85 lines
13 KiB
JavaScript
2 years ago
|
!function(a){a.fn.slide=function(b){return a.fn.slide.defaults={type:"slide",effect:"fold",autoPlay:1,delayTime:750,interTime:3500,triggerTime:150,defaultIndex:0,titCell:".slide-num li",mainCell:".slide-img",targetCell:null,trigger:"mouseover",scroll:1,vis:1,titOnClassName:"on",autoPage:!1,prevCell:".prev",nextCell:".next",pageStateCell:".pageState",opp:!1,pnLoop:!0,easing:"swing",startFun:null,endFun:null,switchLoad:null,playStateCell:".playState",mouseOverStop:!0,defaultPlay:!0,returnDefault:!1},this.each(function(){var c=a.extend({},a.fn.slide.defaults,b),d=a(this),e=c.effect,f=a(c.prevCell,d),g=a(c.nextCell,d),h=a(c.pageStateCell,d),i=a(c.playStateCell,d),j=a(c.titCell,d),k=j.size(),l=a(c.mainCell,d),m=l.children().size(),n=c.switchLoad,o=a(c.targetCell,d),p=parseInt(c.defaultIndex),q=parseInt(c.delayTime),r=parseInt(c.interTime);parseInt(c.triggerTime);var Q,t=parseInt(c.scroll),u=parseInt(c.vis),v="false"==c.autoPlay||0==c.autoPlay?!1:!0,w="false"==c.opp||0==c.opp?!1:!0,x="false"==c.autoPage||0==c.autoPage?!1:!0,y="false"==c.pnLoop||0==c.pnLoop?!1:!0,z="false"==c.mouseOverStop||0==c.mouseOverStop?!1:!0,A="false"==c.defaultPlay||0==c.defaultPlay?!1:!0,B="false"==c.returnDefault||0==c.returnDefault?!1:!0,C=0,D=0,E=0,F=0,G=c.easing,H=null,I=null,J=null,K=c.titOnClassName,L=j.index(d.find("."+K)),M=p=-1==L?p:L,N=p,O=p,P=m>=u?0!=m%t?m%t:t:0,R="leftMarquee"==e||"topMarquee"==e?!0:!1,S=function(){a.isFunction(c.startFun)&&c.startFun(p,k,d,a(c.titCell,d),l,o,f,g)},T=function(){a.isFunction(c.endFun)&&c.endFun(p,k,d,a(c.titCell,d),l,o,f,g)},U=function(){j.removeClass(K),A&&j.eq(N).addClass(K)};if("menu"==c.type)return A&&j.removeClass(K).eq(p).addClass(K),j.hover(function(){Q=a(this).find(c.targetCell);var b=j.index(a(this));I=setTimeout(function(){switch(p=b,j.removeClass(K).eq(p).addClass(K),S(),e){case"fade":Q.stop(!0,!0).animate({opacity:"show"},q,G,T);break;case"slideDown":Q.stop(!0,!0).animate({height:"show"},q,G,T)}},c.triggerTime)},function(){switch(clearTimeout(I),e){case"fade":Q.animate({opacity:"hide"},q,G);break;case"slideDown":Q.animate({height:"hide"},q,G)}}),B&&d.hover(function(){clearTimeout(J)},function(){J=setTimeout(U,q)}),void 0;if(0==k&&(k=m),R&&(k=2),x){if(m>=u)if("leftLoop"==e||"topLoop"==e)k=0!=m%t?(0^m/t)+1:m/t;else{var V=m-u;k=1+parseInt(0!=V%t?V/t+1:V/t),0>=k&&(k=1)}else k=1;j.html("");var W="";if(1==c.autoPage||"true"==c.autoPage)for(var X=0;k>X;X++)W+="<li>"+(X+1)+"</li>";else for(var X=0;k>X;X++)W+=c.autoPage.replace("$",X+1);j.html(W);var j=j.children()}if(m>=u){l.children().each(function(){a(this).width()>E&&(E=a(this).width(),D=a(this).outerWidth(!0)),a(this).height()>F&&(F=a(this).height(),C=a(this).outerHeight(!0))});var Y=l.children(),Z=function(){for(var a=0;u>a;a++)Y.eq(a).clone().addClass("clone").appendTo(l);for(var a=0;P>a;a++)Y.eq(m-a-1).clone().addClass("clone").prependTo(l)};switch(e){case"fold":l.css({position:"relative",width:D,height:C}).children().css({position:"absolute",width:E,left:0,top:0,display:"none"});break;case"top":l.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:'+u*C+'px"></div>').css({top:-(p*t)*C,position:"relative",padding:"0",margin:"0"}).children().css({height:F});break;case"left":l.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:'+u*D+'px"></div>').css({width:m*D,left:-(p*t)*D,position:"relative",overflow:"hidden",padding:"0",margin:"0"}).children().css({"float":"left",width:E});break;case"leftLoop":case"leftMarquee":Z(),l.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; width:'+u*D+'px"></div>').css({width:(m+u+P)*D,position:"relative",overflow:"hidden",padding:"0",margin:"0",left:-(P+p*t)*D}).children().css({"float":"left",width:E});break;case"topLoop":case"topMarquee":Z(),l.wrap('<div class="tempWrap" style="overflow:hidden; position:relative; height:'+u*C+'px"></div>').css({height:(m+u+P)*C,position:"relative",padding:"0",margin:"0",top:-(P+p*t)*C}).children().css({height:F})}}var $=function(a){var b=a*t;return a==k?b=m:-1==a&&0!=m%t&&(b=-m%t),b},_=function(b){var c=functio
|
||
|
|
||
|
/*楼层自动跳转*/
|
||
|
;(function($){
|
||
|
$.fn.floor = function(opitons){
|
||
|
var defaults = {
|
||
|
floor : '.part',
|
||
|
floorNav : '.floor-nav-box li',
|
||
|
};
|
||
|
return this.each(function(){
|
||
|
var a = $.extend({}, defaults , opitons);
|
||
|
var b = $(a.floor);
|
||
|
var c = $(a.floorNav);
|
||
|
var outI;
|
||
|
c.eq(0).addClass('on');
|
||
|
$(window).scroll(function(){
|
||
|
var h = $(window).height();
|
||
|
t = $(window).scrollTop();
|
||
|
b.each(function(){
|
||
|
var i = $(this),
|
||
|
hh = b.eq(0).offset().top;
|
||
|
iT = i.offset().top+150;
|
||
|
if(h+t-iT>h/2){
|
||
|
c.removeClass('on').eq(i.index()).addClass('on');
|
||
|
};
|
||
|
if(t<50){
|
||
|
c.removeClass('on').eq(0).addClass('on')
|
||
|
};
|
||
|
});
|
||
|
});
|
||
|
c.click(function(){
|
||
|
var i = $(this),
|
||
|
t = b.eq(i.index()).offset().top;
|
||
|
outI = i.index();
|
||
|
i.addClass('on').siblings().removeClass('on');
|
||
|
$('body,html').animate({"scrollTop":t},500);
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
})(jQuery);
|
||
|
/*选项卡*/
|
||
|
;(function($){
|
||
|
$.fn.tab = function(opitons){
|
||
|
var defaults = {
|
||
|
tabNum : '.tab-num li',
|
||
|
tabCell : '.tab-con',
|
||
|
tabCur : 0 ,
|
||
|
trigger : 'click',
|
||
|
};
|
||
|
return this.each(function(){
|
||
|
var a = $.extend({}, defaults , opitons);
|
||
|
var b = $(this);
|
||
|
var c = $(a.tabNum,b);
|
||
|
var d = $(a.tabCell,b);
|
||
|
var e = a.trigger;
|
||
|
var i = a.tabCur;
|
||
|
c.eq(i).addClass('on');
|
||
|
d.hide().eq(i).show();
|
||
|
c.on(e,function(){
|
||
|
var _t = $(this);
|
||
|
var i = _t.index();
|
||
|
c.removeClass('on').eq(i).addClass('on');
|
||
|
d.hide().eq(i).show();
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
})(jQuery);
|
||
|
/*jq字数限制*/
|
||
|
;(function($){
|
||
|
$.fn.jsNumber = function(opitons){
|
||
|
var defaults = {
|
||
|
number : 50,
|
||
|
};
|
||
|
var a = $.extend({}, defaults , opitons);
|
||
|
this.each(function(){
|
||
|
var b = a.number,
|
||
|
i = $(this);
|
||
|
if(i.text().length>b){
|
||
|
i.text(i.text().substring(0,b));
|
||
|
i.html(i.html()+'...')
|
||
|
}
|
||
|
})
|
||
|
return this;
|
||
|
}
|
||
|
})(jQuery);
|