⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repaint_r1.3.aaa.js

📁 js热门推荐代码 js热门推荐代码
💻 JS
📖 第 1 页 / 共 5 页
字号:
	this.getCurrentScroll=function() {		return currentScroll;	};	/**	 * ontween Animation onTween handler.	 * Used to keep track of the scrollLeft property of the scrollBody.	 * @private	 **/	var ontween=function(e,data){		// this is faster than just looking it up from the DOM.		currentScroll=this.anim.doMethod('scroll', this.animAttrs.scroll.from, this.animAttrs.scroll.to)[0];	};		/**	 * oncomplete Animation onComplete handler.	 * Fires the onPageChange event.	 * @private	 **/	var oncomplete=function(e,data){		// only fire if it actually finished.		if(data[0].duration >= this.animDur) {			data=data[0];			data.carousel=this;			var _toString=data.toString;			data.toString = function(){ return _toString() + ', current page:' + this.carousel.current; };			//data.toString=function(){return this.time.getTime()+' duration:'+this.duration+', frames:'+this.frames+', fps:'+this.fps+', carousel:'+this.carousel.toString();};							this.onPageChange.fire(data);		}	};	/**	 * onclick Method	 * Attached to click event of scrollBody	 * Through event bubbling, fires whenever an element in the scrolling body is clicked, unless event is caught and killed before bubbling up.	 * fires the onClick event.	 * @private	 **/	var onclick=function(e) {		this.onClick.fire(e);	};	/**	 * element Object	 * Reference to the root of the Carousel element.	 * Accessible via the privileged getElement() method.	 * @private	 **/	var _element=null;		/**	 * getElement prototype method	 * @privileged	 * @return {HTMLElement | null} The root element of the Carousel.	 * @description Note: The element is not set until init is called.	 **/	this.getElement=function() {		return _element;	};	/**	 * init Method	 * @param el { String | HTMLElement } ID of or reference to the root element of the carousel	 * @param args { Object } Name-value pair of any public member items that should be replaced.  For example, you send it {easeMethod:YAHOO.util.easeNone,animDur:2} to overwrite the default easing method and animation duration.	 *  With great power comes great responsibility!	 * @description Typically called by CarouselMgr.init or CarouselMgr.initAll.	 * @privileged	 **/	this.init=function(el,args) {		el=$D.get(el);		if(el) {			_element=el;		}		$D.generateId(el,'carousel_');		s = $D.getElementsByClassName('scrollbody','div',el)[0];				if(typeof(args) == 'object') {			for(var i in args) {				this[i]=args[i];			}		}						var me=this;		var list = this.pages = $D.getElementsBy(function(el) { return me.pageFinder(el); },this.pageTagName,el);		var len = list.length;				if(!el || !s || !len) {			return false;		}				// set up the exposed variables that don't exist pre-init.		this.onScrollStart=new $U.CustomEvent('scrollstart',this);		this.onPageChange=new $U.CustomEvent('scrollcomplete',this);		this.onClick=new $U.CustomEvent('click',this);		this.onAutoPlayStart=new $U.CustomEvent('autoplaystart',this);		this.onAutoPlayStop=new $U.CustomEvent('autoplaystop',this);				var r = $D.getRegion(list[0]);		// get region of first item, as all "page" items should be same width		this.scrollDistance = r.right - r.left;			// width of first "page" item				this.scrollBody = s;		$E.addListener(s,'click',onclick,this,true);				// set some styles here to make carousels less rude to the myBar		var h=$D.getRegion(s.parentNode);		h=(h.bottom-h.top)+'px';		s.parentNode.style.height=h;		s.style.height=h;		s.style.position='absolute';		//s.style.overflow='auto';		var p=$D.getElementsByClassName('scrollpages','div',s)[0];		p.style.width=(len * this.scrollDistance * 1.0)+'px';		p.style.position='absolute';				// http://bug.corp.yahoo.com/show_bug.cgi?id=832779		// figure out what page we're REALLY on (which will usually be 0), and then go there.		// this needs to be down here, because the browser won't get the right values unless the styles and heights above are set.		// This is the ONLY time that we manually read the scrollLeft property, since this tends to be very sluggish to read in Mozilla.		var sl = Math.round(s.scrollLeft / this.scrollDistance);		if(sl < 0) sl = 0;		else if(sl >= this.pages.length) sl = this.pages.length-1;		this.current = sl;						this.scrollBody.scrollLeft = currentScroll = sl * this.scrollDistance;				this.anim=new $S(this.scrollBody , this.animAttrs, this.animDur, this.easeMethod);		this.anim.onTween.subscribe(ontween,this,true);		this.anim.onComplete.subscribe(oncomplete,this,true);				if( len > 1 ){			// only add nav buttons and page indicators if more than one page			addNavButtons.call(this);			addPageIndicators.call(this);			updateNavState.call(this);		} else this.navLinks=[];		list=s=null;		return true;	};			/**	 * autoPlayTimeOut	 * @private	 * Recording the timeout ID so that it can be cleared when autoplay is stopped.	 **/	var autoPlayTimeOut=0;	/**	 * autoPlayFn {null | Function}	 * @private	 * @description Function that actually switches the card.  Set as a timeout by autoPlayer.	 **/	var autoPlayFn=function(){		me.autoPlay= (me.autoPlayDirection>0)?me.scrollNext():me.scrollPrev();	};	/**	 * autoPlaySubscribed {Boolean}	 * True if autoPlayer has subscribed to the onPageChange event.	 * @private	 **/	var autoPlaySubscribed=false;	/**	 * autoPlayer {Function}	 * @private	 * @description The autoPlay workhorse.  Sets up the proper things based on the value of this.autoPlay.	 **/	var autoPlayer=function() {		clearTimeout(autoPlayTimeOut);				// check to see if it's going to fail before it does.		// this ends autoplay as soon as it's known that it will stop.		if(me.autoPlay && !me.roundRobin && (me.current == me.pages.length-1 && me.autoPlayDirection > 0 || me.autoPlayDirection <= 0 && me.current == 0) ) {			me.autoPlay = false;		}				if(!me.autoPlay) {			// stop if running.  Unsubscribe.			me.onPageChange.unsubscribe(autoPlayer);			autoPlaySubscribed=false;			me.onAutoPlayStop.fire(me.current);		} else {			/*			1. In me.autoPlayDur seconds, call autoPlayFn			2. This scrolls next or prev.			3. When the scrolling is done, it triggers the onPageChange event.			4. This calls autoPlayer.  (Goto step 1.)			*/			if(!autoPlaySubscribed) {				autoPlaySubscribed=true;				me.onPageChange.subscribe(autoPlayer);				autoPlayFn();			} else {				autoPlayTimeOut=window.setTimeout(autoPlayFn,me.autoPlayDur*1000);			}		}	};	/**	 * autoPlayStart method	 * @description Starts the autoPlay	 * @privileged	 **/	this.autoPlayStart=function() {		if(!this.autoP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -