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

📄 stackcontainer.js

📁 这是一个ajax的例子大家好好的看看就是一个鱼眼的效果
💻 JS
📖 第 1 页 / 共 2 页
字号:
if(!dojo._hasResource["dijit.layout.StackContainer"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dijit.layout.StackContainer"] = true;dojo.provide("dijit.layout.StackContainer");dojo.require("dijit._Templated");dojo.require("dijit.layout._LayoutWidget");dojo.require("dijit.form.Button");dojo.require("dijit.Menu");dojo.requireLocalization("dijit", "common", null, "zh,pt,da,tr,ru,de,sv,ja,he,fi,nb,el,ar,ROOT,pt-pt,cs,fr,es,ko,nl,zh-tw,pl,it,hu");dojo.declare(	"dijit.layout.StackContainer",	dijit.layout._LayoutWidget,	{	// summary: 	//	A container that has multiple children, but shows only	//	one child at a time	//	// description:	// 	A container for widgets (ContentPanes, for example) That displays	//	only one Widget at a time.	//		//	Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild	//	//	Can be base class for container, Wizard, Show, etc.	// 	//	// doLayout: Boolean	//  if true, change the size of my currently displayed child to match my size	doLayout: true,	_started: false,/*=====	// selectedChildWidget: Widget	//	References the currently selected child widget, if any	//	selectedChildWidget: null,=====*/	postCreate: function(){		dijit.setWaiRole((this.containerNode || this.domNode), "tabpanel");		this.connect(this.domNode, "onkeypress", this._onKeyPress);	},		startup: function(){		if(this._started){ return; }		var children = this.getChildren();		// Setup each page panel		dojo.forEach(children, this._setupChild, this);		// Figure out which child to initially display		dojo.some(children, function(child){			if(child.selected){				this.selectedChildWidget = child;			}			return child.selected;		}, this);		var selected = this.selectedChildWidget;		// Default to the first child		if(!selected && children[0]){			selected = this.selectedChildWidget = children[0];			selected.selected = true;		}		if(selected){			this._showChild(selected);		}		// Now publish information about myself so any StackControllers can initialize..		dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);		this.inherited(arguments);	},	_setupChild: function(/*Widget*/ page){		// Summary: prepare the given child		page.domNode.style.display = "none";		// since we are setting the width/height of the child elements, they need		// to be position:relative, or IE has problems (See bug #2033)		page.domNode.style.position = "relative";		return page; // dijit._Widget	},	addChild: function(/*Widget*/ child, /*Integer?*/ insertIndex){		// summary: Adds a widget to the stack		 		dijit._Container.prototype.addChild.apply(this, arguments);		child = this._setupChild(child);		if(this._started){			// in case the tab titles have overflowed from one line to two lines			this.layout();			dojo.publish(this.id+"-addChild", [child, insertIndex]);			// if this is the first child, then select it			if(!this.selectedChildWidget){				this.selectChild(child);			}		}	},	removeChild: function(/*Widget*/ page){		// summary: Removes the pane from the stack		dijit._Container.prototype.removeChild.apply(this, arguments);		// If we are being destroyed than don't run the code below (to select another page), because we are deleting		// every page one by one		if(this._beingDestroyed){ return; }		if(this._started){			// this will notify any tablists to remove a button; do this first because it may affect sizing			dojo.publish(this.id+"-removeChild", [page]);			// in case the tab titles now take up one line instead of two lines			this.layout();		}		if(this.selectedChildWidget === page){			this.selectedChildWidget = undefined;			if(this._started){				var children = this.getChildren();				if(children.length){					this.selectChild(children[0]);				}			}		}	},	selectChild: function(/*Widget*/ page){		// summary:		//	Show the given widget (which must be one of my children)		page = dijit.byId(page);		if(this.selectedChildWidget != page){			// Deselect old page and select new one			this._transition(page, this.selectedChildWidget);			this.selectedChildWidget = page;			dojo.publish(this.id+"-selectChild", [page]);		}	},	_transition: function(/*Widget*/newWidget, /*Widget*/oldWidget){		if(oldWidget){			this._hideChild(oldWidget);		}		this._showChild(newWidget);		// Size the new widget, in case this is the first time it's being shown,		// or I have been resized since the last time it was shown.		// page must be visible for resizing to work		if(this.doLayout && newWidget.resize){			newWidget.resize(this._containerContentBox || this._contentBox);		}	},	_adjacent: function(/*Boolean*/ forward){		// summary: Gets the next/previous child widget in this container from the current selection		var children = this.getChildren();		var index = dojo.indexOf(children, this.selectedChildWidget);		index += forward ? 1 : children.length - 1;		return children[ index % children.length ]; // dijit._Widget	},	forward: function(){		// Summary: advance to next page		this.selectChild(this._adjacent(true));	},	back: function(){		// Summary: go back to previous page		this.selectChild(this._adjacent(false));	},	_onKeyPress: function(e){		dojo.publish(this.id+"-containerKeyPress", [{ e: e, page: this}]);	},	layout: function(){		if(this.doLayout && this.selectedChildWidget && this.selectedChildWidget.resize){			this.selectedChildWidget.resize(this._contentBox);		}	},	_showChild: function(/*Widget*/ page){		var children = this.getChildren();		page.isFirstChild = (page == children[0]);		page.isLastChild = (page == children[children.length-1]);		page.selected = true;		page.domNode.style.display="";		if(page._loadCheck){			page._loadCheck(); // trigger load in ContentPane		}		if(page.onShow){			page.onShow();		}	},	_hideChild: function(/*Widget*/ page){		page.selected=false;		page.domNode.style.display="none";		if(page.onHide){			page.onHide();		}	},	closeChild: function(/*Widget*/ page){		// summary:		//	callback when user clicks the [X] to remove a page		//	if onClose() returns true then remove and destroy the child		var remove = page.onClose(this, page);		if(remove){			this.removeChild(page);			// makes sure we can clean up executeScripts in ContentPane onUnLoad			page.destroyRecursive();		}	},	destroy: function(){		this._beingDestroyed = true;		this.inherited(arguments);	}});dojo.declare(	"dijit.layout.StackController",	[dijit._Widget, dijit._Templated, dijit._Container],	{	// summary:	//	Set of buttons to select a page in a page list.	//	Monitors the specified StackContainer, and whenever a page is	//	added, deleted, or selected, updates itself accordingly.		templateString: "<span wairole='tablist' dojoAttachEvent='onkeypress' class='dijitStackController'></span>",		// containerId: String		//	the id of the page container that I point to		containerId: "",

⌨️ 快捷键说明

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