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

📄 repaint_r1.3.aaa.js

📁 js热门推荐代码 js热门推荐代码
💻 JS
📖 第 1 页 / 共 5 页
字号:
	var o = this;	var container = this.getElement();	var indic = container.getElementsByTagName("h2")[0].getElementsByTagName("span")[0];	var linkwds = indic.getElementsByTagName("a");var clear = function(){	var lnks = indic.getElementsByTagName("a");	for(var i=0,j=lnks.length; i<j; i++){		lnks[i].style.color = "";	}};	for(var i=0,j=linkwds.length; i<j; i++){		linkwds[i].href = "#pg:" + (i+1);		linkwds[i].carousel = this;		linkwds[i].onmousedown = linkwds[i].onclick = function(){			clear();			var n = this.href.split("#pg:")[1] - 1;			o.scrollTo(n);			this.style.color = "red";		};	}	var p=this.pages.length;	for(var x=0;x<p;x++){		var a=this.navLinks[x] || document.createElement('a');		a.href='#pg:'+(x+1);		a.index=x;		a.carousel=this;		a.onmousedown=a.onclick=function(e){			clear();			indic.getElementsByTagName("a")[this.href.split("#pg:")[1] - 1].style.color = "red";			o.scrollTo_click(e);		}		if(x==this.current) {			a.className='current';		}		n.appendChild(a);		this.navLinks[x]=a;	}		var s=this.scrollBody;	s.parentNode.insertBefore(n,s);	return;};/** * removeNavLinks Method * @description Clears out the navLinks array.  Called by unload, and also by addPageIndicators if pages were removed by an ajax call. * @private * @param C {Carousel Object} Reference to the carousel whose navLinks are getting yanked out. **/var removeNavLinks=function() {	if(this.navLinks) {		for(var j=this.navLinks.length-1;j>-1;j--) {			var a=this.navLinks[j];			if(a) {				a.onclick=null;				a.onmousedown=null;				a.onmouseup=null;				a.carousel=null;			}			a=null;			this.navLinks[j]=null;	//		delete this.navLinks[j];		}	}	this.navLinks=[];};	/** * addNavButtons Method * @description Adds the next/prev page indicators. * @private * @param C {Carousel Object} Reference to the carousel that is getting set up. **/var addNavButtons=function() {	// create prev/next links, if they haven't already been done.	if(this.prev || this.next) return;	var p=document.createElement('a'), n=p.cloneNode(true);		var i=this.getElement().id;		n.href=p.href="#"+i;		// add appropriate classes to each	p.className="prev";	n.className="next";		// insert nodes into dom before <div class="scrollbody">	var s=this.scrollBody;	s.parentNode.insertBefore(p, s);	s.parentNode.insertBefore(n, s);		// add handlers	p.onmousedown=p.onclick=this.scrollPrev_click;	n.onmousedown=n.onclick=this.scrollNext_click;		this.prev=p;	this.next=n;	n.carousel=p.carousel=this;	s=null;};/** * updateNavState Method * @description Update the state of the page/prev/next links. * @private * @param C {Carousel Object} Reference to the carousel that is getting updated. **/var updateNavState=function() {	// get # of pages	var l = this.navLinks.length;		// update page indicator styles	for (var x=0; x<l; x++) {		if(x == this.current) {			this.navLinks[x].className='current';		} else {			this.navLinks[x].className='';		}	}	// update button styles	if(this.current == 0 && !this.roundRobin){		// first page (left inactive)		$D.addClass(this.prev,'off');		//$D.setStyle(this.prev,'opacity',0.6);		$D.removeClass(this.next,'off');		//$D.setStyle(this.next,'opacity',1);		$D.setStyle(this.next,'cursor','')		$D.setStyle(this.prev,'cursor','default')	}else if(this.current == (l-1) && !this.roundRobin){		// last page (right inactive)		$D.removeClass(this.prev,'off');		//$D.setStyle(this.prev,'opacity',1);		$D.addClass(this.next,'off');		//$D.setStyle(this.next,'opacity',0.6);		$D.setStyle(this.prev,'cursor','')		$D.setStyle(this.next,'cursor','default')	} else {		// all other pages (all active)		$D.removeClass(this.prev,'off');		//$D.setStyle(this.prev,'opacity',1);		$D.removeClass(this.next,'off');		//$D.setStyle(this.next,'opacity',1);		$D.setStyle(this.next,'cursor','')		$D.setStyle(this.prev,'cursor','')	}};/** * clickHandler method * @description Creates an event handler which can be assigned to a carousel A tag.  Used to create the scrollNext_click, scrollPrev_click, and scrollTo_click methods. * @private * @param whichFn {String} The name of the member function of the Carousel object to call, if appropriate.  Note: Not a function--send in the NAME of a function as a string. * @param fnFailure {Function} In addition to !a and !a.carousel, additional failure cases can be specified.  This function is called with the A tag passed as an arg.  If it returns True, then the carousel operation is aborted and normal behavior is used. * @param fnArgs {Function} This function can be specified to send additional arguments to the carousel function.  The A tag is passed as an argument, and the return value is sent to fnWhich. **/var clickHandler=function(whichFn,fnFailure,fnArgs) {	return function(e) {		e=e||window.event;		fnFailure=fnFailure || function(){return false;};		fnArgs=fnArgs || function(){};		var a=$E.getTarget(e);		if(!a || !a.carousel || fnFailure(a)) {			return true;		}		if(!a.didMouseDown) {			// do the stuff, only the first time.			a.carousel.autoPlay=false;			a.carousel[whichFn](fnArgs(a));		} else {			// if we got a mousedown, then this is click, and it's time to blur.			// flag will be reset on the next line.			a.blur();		}		// record or reset.		a.didMouseDown=(e.type=='mousedown');		// break reference to prevent the leak.		a=null;		$E.stopEvent(e);		return false;	};};Carousel = function(el,args) {		/**	 * self-reference.	 * @private	 **/	var me=this;	/**	 * currentScroll property	 * Stores the current position of the scroller.	 * @private	 **/	var currentScroll=0;	/**	 * getCurrentScroll method	 * @return {Number} the current position of the scroller.	 * @privileged	 **/

⌨️ 快捷键说明

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