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

📄 fisheyelist.js

📁 这是一个ajax的例子大家好好的看看就是一个鱼眼的效果
💻 JS
📖 第 1 页 / 共 2 页
字号:
		if(this.itemCount <= 0){ return; }		//		// figure out our main index		//		var pos = this.isHorizontal ? x : y;		var prx = this.isHorizontal ? this.proximityLeft : this.proximityTop;		var siz = this.isHorizontal ? this.itemWidth : this.itemHeight;		var sim = this.isHorizontal ? 			(1.0-this.timerScale)*this.itemWidth + this.timerScale*this.itemMaxWidth :			(1.0-this.timerScale)*this.itemHeight + this.timerScale*this.itemMaxHeight ;		var cen = ((pos - prx) / siz) - 0.5;		var max_off_cen = (sim / siz) - 0.5;		if(max_off_cen > this.effectUnits){ max_off_cen = this.effectUnits; }		//		// figure out our off-axis weighting		//		var off_weight = 0;		if(this.anchorEdge == this.EDGE.BOTTOM){			var cen2 = (y - this.proximityTop) / this.itemHeight;			off_weight = (cen2 > 0.5) ? 1 : y / (this.proximityTop + (this.itemHeight / 2));		}		if(this.anchorEdge == this.EDGE.TOP){			var cen2 = (y - this.proximityTop) / this.itemHeight;			off_weight = (cen2 < 0.5) ? 1 : (this.totalHeight - y) / (this.proximityBottom + (this.itemHeight / 2));		}		if(this.anchorEdge == this.EDGE.RIGHT){			var cen2 = (x - this.proximityLeft) / this.itemWidth;			off_weight = (cen2 > 0.5) ? 1 : x / (this.proximityLeft + (this.itemWidth / 2));		}		if(this.anchorEdge == this.EDGE.LEFT){			var cen2 = (x - this.proximityLeft) / this.itemWidth;			off_weight = (cen2 < 0.5) ? 1 : (this.totalWidth - x) / (this.proximityRight + (this.itemWidth / 2));		}		if(this.anchorEdge == this.EDGE.CENTER){			if(this.isHorizontal){				off_weight = y / (this.totalHeight);			}else{				off_weight = x / (this.totalWidth);			}			if(off_weight > 0.5){				off_weight = 1 - off_weight;			}			off_weight *= 2;		}		//		// set the sizes		//		for(var i=0; i<this.itemCount; i++){			var weight = this._weighAt(cen, i);			if(weight < 0){weight = 0;}			this._setItemSize(i, weight * off_weight);		}		//		// set the positions		//		var main_p = Math.round(cen);		var offset = 0;		if(cen < 0){			main_p = 0;		}else if(cen > this.itemCount - 1){			main_p = this.itemCount -1;		}else{			offset = (cen - main_p) * ((this.isHorizontal ? this.itemWidth : this.itemHeight) - this.children[main_p].sizeMain);		}		this._positionElementsFrom(main_p, offset);	},	_weighAt: function(/*Integer*/ cen, /*Integer*/ i){		var dist = Math.abs(cen - i);		var limit = ((cen - i) > 0) ? this.children[i].effectRangeRght : this.children[i].effectRangeLeft;		return (dist > limit) ? 0 : (1 - dist / limit); // Integer	},	_setItemSize: function(p, scale){		scale *= this.timerScale;		var w = Math.round(this.itemWidth  + ((this.itemMaxWidth  - this.itemWidth ) * scale));		var h = Math.round(this.itemHeight + ((this.itemMaxHeight - this.itemHeight) * scale));		if(this.isHorizontal){			this.children[p].sizeW = w;			this.children[p].sizeH = h;			this.children[p].sizeMain = w;			this.children[p].sizeOff  = h;			var y = 0;			if(this.anchorEdge == this.EDGE.TOP){				y = (this.children[p].cenY - (this.itemHeight / 2));			}else if(this.anchorEdge == this.EDGE.BOTTOM){				y = (this.children[p].cenY - (h - (this.itemHeight / 2)));			}else{				y = (this.children[p].cenY - (h / 2));			}			this.children[p].usualX = Math.round(this.children[p].cenX - (w / 2));			this.children[p].domNode.style.top  = y + 'px';			this.children[p].domNode.style.left  = this.children[p].usualX + 'px';		}else{			this.children[p].sizeW = w;			this.children[p].sizeH = h;			this.children[p].sizeOff  = w;			this.children[p].sizeMain = h;			var x = 0;			if(this.anchorEdge == this.EDGE.LEFT){				x = this.children[p].cenX - (this.itemWidth / 2);			}else if (this.anchorEdge == this.EDGE.RIGHT){				x = this.children[p].cenX - (w - (this.itemWidth / 2));			}else{				x = this.children[p].cenX - (w / 2);			}			this.children[p].domNode.style.left = x + 'px';			this.children[p].usualY = Math.round(this.children[p].cenY - (h / 2));			this.children[p].domNode.style.top  = this.children[p].usualY + 'px';		}		this.children[p].domNode.style.width  = w + 'px';		this.children[p].domNode.style.height = h + 'px';		if(this.children[p].svgNode){			this.children[p].svgNode.setSize(w, h);		}	},	_positionElementsFrom: function(p, offset){		var pos = 0;		if(this.isHorizontal){			pos = Math.round(this.children[p].usualX + offset);			this.children[p].domNode.style.left = pos + 'px';		}else{			pos = Math.round(this.children[p].usualY + offset);			this.children[p].domNode.style.top = pos + 'px';		}		this._positionLabel(this.children[p]);		// position before		var bpos = pos;		for(var i=p-1; i>=0; i--){			bpos -= this.children[i].sizeMain;			if (this.isHorizontal){				this.children[i].domNode.style.left = bpos + 'px';			}else{				this.children[i].domNode.style.top = bpos + 'px';			}			this._positionLabel(this.children[i]);		}		// position after		var apos = pos;		for(var i=p+1; i<this.itemCount; i++){			apos += this.children[i-1].sizeMain;			if(this.isHorizontal){				this.children[i].domNode.style.left = apos + 'px';			}else{				this.children[i].domNode.style.top = apos + 'px';			}			this._positionLabel(this.children[i]);		}	},	_positionLabel: function(itm){		var x = 0;		var y = 0;				var mb = dojo.marginBox(itm.lblNode);		if(this.labelEdge == this.EDGE.TOP){			x = Math.round((itm.sizeW / 2) - (mb.w / 2));			y = -mb.h;		}		if(this.labelEdge == this.EDGE.BOTTOM){			x = Math.round((itm.sizeW / 2) - (mb.w / 2));			y = itm.sizeH;		}		if(this.labelEdge == this.EDGE.LEFT){			x = -mb.w;			y = Math.round((itm.sizeH / 2) - (mb.h / 2));		}		if(this.labelEdge == this.EDGE.RIGHT){			x = itm.sizeW;			y = Math.round((itm.sizeH / 2) - (mb.h / 2));		}		itm.lblNode.style.left = x + 'px';		itm.lblNode.style.top  = y + 'px';	},	_calcHitGrid: function(){		var pos = dojo.coords(this.domNode, true);		this.hitX1 = pos.x - this.proximityLeft;		this.hitY1 = pos.y - this.proximityTop;		this.hitX2 = this.hitX1 + this.totalWidth;		this.hitY2 = this.hitY1 + this.totalHeight;	},	_toEdge: function(inp, def){		return this.EDGE[inp.toUpperCase()] || def;	},	_expandSlowly: function(){		// summary: slowly expand the image to user specified max size		if(!this.isOver){ return; }		this.timerScale += 0.2;		this._paint();		if(this.timerScale<1.0){			setTimeout(dojo.hitch(this, "_expandSlowly"), 10);		}	},	destroyRecursive: function(){		// need to disconnect when we destroy		dojo.disconnect(this._onMouseOutHandle);		dojo.disconnect(this._onMouseMoveHandle);		dojo.disconnect(this._addChildHandle);		if (this.isFixed) { dojo.disconnect(this._onScrollHandle); }		dojo.disconnect(this._onResizeHandle); 		this.inherited("destroyRecursive",arguments);	}});dojo.declare("dojox.widget.FisheyeListItem", [dijit._Widget, dijit._Templated, dijit._Contained], {	/*	 * summary	 *	Menu item inside of a FisheyeList.	 *	See FisheyeList documentation for details on usage.	 */	// iconSrc: String	//	pathname to image file (jpg, gif, png, etc.) of icon for this menu item	iconSrc: "",	// label: String	//	label to print next to the icon, when it is moused-over	label: "",	// id: String	//	will be set to the id of the orginal div element	id: "",	_blankImgPath: dojo.moduleUrl("dojo", "resources/blank.gif"),	templateString:		'<div class="dojoxFisheyeListItem">' +		'  <img class="dojoxFisheyeListItemImage" dojoAttachPoint="imgNode" dojoAttachEvent="onmouseover:onMouseOver,onmouseout:onMouseOut,onclick:onClick">' +		'  <div class="dojoxFisheyeListItemLabel" dojoAttachPoint="lblNode"></div>' +		'</div>',	_isNode: function(/* object */wh){		//	summary:		//		checks to see if wh is actually a node.		if(typeof Element == "function") {			try{				return wh instanceof Element;	//	boolean			}catch(e){}		}else{			// best-guess			return wh && !isNaN(wh.nodeType);	//	boolean		}	},	_hasParent: function(/*Node*/node){		//	summary:		//		returns whether or not node is a child of another node.		return Boolean(node && node.parentNode && this._isNode(node.parentNode));	//	boolean	},	postCreate: function() {		// set image		if((this.iconSrc.toLowerCase().substring(this.iconSrc.length-4)==".png")&&(dojo.isIE)&&(dojo.isIE<7)){			/* we set the id of the new fisheyeListItem to the id of the div defined in the HTML */			if(this._hasParent(this.imgNode) && this.id != ""){				var parent = this.imgNode.parentNode;				parent.setAttribute("id", this.id);			}			this.imgNode.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.iconSrc+"', sizingMethod='scale')";			this.imgNode.src = this._blankImgPath.toString();		}else{			if(this._hasParent(this.imgNode) && this.id != ""){				var parent = this.imgNode.parentNode;				parent.setAttribute("id", this.id);			}			this.imgNode.src = this.iconSrc;		}		// Label		if(this.lblNode){			this.lblNode.appendChild(document.createTextNode(this.label));		}		dojo.setSelectable(this.domNode, false);		this.startup();	},	startup: function(){		this.parent = this.getParent();	},		onMouseOver: function(/*Event*/ e){		// summary: callback when user moves mouse over this menu item		// in conservative mode, don't activate the menu until user mouses over an icon		if(!this.parent.isOver){			this.parent._setActive(e);		}		if(this.label != "" ){			dojo.addClass(this.lblNode, "dojoxFishSelected");			this.parent._positionLabel(this);		}	},		onMouseOut: function(/*Event*/ e){		// summary: callback when user moves mouse off of this menu item		dojo.removeClass(this.lblNode, "dojoxFishSelected");	},	onClick: function(/*Event*/ e){		// summary: user overridable callback when user clicks this menu item	}});}

⌨️ 快捷键说明

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