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

📄 html.js

📁 dojo与json创建无限级树的时候,当在父结点下添加了一个新结点,我怎么让父亲结点重新调用json加载一下子结点内容.
💻 JS
📖 第 1 页 / 共 2 页
字号:
dojo.fx.html.wiper = function(node, controlNode) {	this.node = dojo.byId(node);	if(controlNode) {		dojo.event.connect(dojo.byId(controlNode), "onclick", this, "toggle");	}}dojo.lang.extend(dojo.fx.html.wiper, {	duration: dojo.fx.duration,	_anim: null,	toggle: function() {		if(!this._anim) {			var type = "wipe" + (dojo.style.isVisible(this.node) ? "Out" : "In");			this._anim = dojo.fx[type](this.node, this.duration, dojo.lang.hitch(this, "_callback"));		}	},	_callback: function() {		this._anim = null;	}});dojo.fx.html.explode = function(start, endNode, duration, callback, dontPlay) {	var startCoords = dojo.style.toCoordinateArray(start);	var outline = document.createElement("div");	with(outline.style) {		position = "absolute";		border = "1px solid black";		display = "none";	}	document.body.appendChild(outline);	endNode = dojo.byId(endNode);	with(endNode.style) {		visibility = "hidden";		display = "block";	}	var endCoords = dojo.style.toCoordinateArray(endNode);	with(endNode.style) {		display = "none";		visibility = "visible";	}	var anim = new dojo.animation.Animation(		new dojo.math.curves.Line(startCoords, endCoords),		duration||dojo.fx.duration, 0	);	dojo.event.connect(anim, "onBegin", function(e) {		outline.style.display = "block";	});	dojo.event.connect(anim, "onAnimate", function(e) {		with(outline.style) {			left = e.x + "px";			top = e.y + "px";			width = e.coords[2] + "px";			height = e.coords[3] + "px";		}	});	dojo.event.connect(anim, "onEnd", function() {		endNode.style.display = "block";		outline.parentNode.removeChild(outline);		if(callback) { callback(endNode, anim); }	});	if(!dontPlay) { anim.play(); }	return anim;};dojo.fx.html.implode = function(startNode, end, duration, callback, dontPlay) {	var startCoords = dojo.style.toCoordinateArray(startNode);	var endCoords = dojo.style.toCoordinateArray(end);	startNode = dojo.byId(startNode);	var outline = document.createElement("div");	with(outline.style) {		position = "absolute";		border = "1px solid black";		display = "none";	}	document.body.appendChild(outline);	var anim = new dojo.animation.Animation(		new dojo.math.curves.Line(startCoords, endCoords),		duration||dojo.fx.duration, 0	);	dojo.event.connect(anim, "onBegin", function(e) {		startNode.style.display = "none";		outline.style.display = "block";	});	dojo.event.connect(anim, "onAnimate", function(e) {		with(outline.style) {			left = e.x + "px";			top = e.y + "px";			width = e.coords[2] + "px";			height = e.coords[3] + "px";		}	});	dojo.event.connect(anim, "onEnd", function() {		outline.parentNode.removeChild(outline);		if(callback) { callback(startNode, anim); }	});	if(!dontPlay) { anim.play(); }	return anim;};dojo.fx.html.Exploder = function(triggerNode, boxNode) {	triggerNode = dojo.byId(triggerNode);	boxNode = dojo.byId(boxNode);	var _this = this;	// custom options	this.waitToHide = 500;	this.timeToShow = 100;	this.waitToShow = 200;	this.timeToHide = 70;	this.autoShow = false;	this.autoHide = false;	var animShow = null;	var animHide = null;	var showTimer = null;	var hideTimer = null;	var startCoords = null;	var endCoords = null;	this.showing = false;	this.onBeforeExplode = null;	this.onAfterExplode = null;	this.onBeforeImplode = null;	this.onAfterImplode = null;	this.onExploding = null;	this.onImploding = null;	this.timeShow = function() {		clearTimeout(showTimer);		showTimer = setTimeout(_this.show, _this.waitToShow);	}	this.show = function() {		clearTimeout(showTimer);		clearTimeout(hideTimer);		//triggerNode.blur();		if( (animHide && animHide.status() == "playing")			|| (animShow && animShow.status() == "playing")			|| _this.showing ) { return; }		if(typeof _this.onBeforeExplode == "function") { _this.onBeforeExplode(triggerNode, boxNode); }		animShow = dojo.fx.html.explode(triggerNode, boxNode, _this.timeToShow, function(e) {			_this.showing = true;			if(typeof _this.onAfterExplode == "function") { _this.onAfterExplode(triggerNode, boxNode); }		});		if(typeof _this.onExploding == "function") {			dojo.event.connect(animShow, "onAnimate", this, "onExploding");		}	}	this.timeHide = function() {		clearTimeout(showTimer);		clearTimeout(hideTimer);		if(_this.showing) {			hideTimer = setTimeout(_this.hide, _this.waitToHide);		}	}	this.hide = function() {		clearTimeout(showTimer);		clearTimeout(hideTimer);		if( animShow && animShow.status() == "playing" ) {			return;		}		_this.showing = false;		if(typeof _this.onBeforeImplode == "function") { _this.onBeforeImplode(triggerNode, boxNode); }		animHide = dojo.fx.html.implode(boxNode, triggerNode, _this.timeToHide, function(e){			if(typeof _this.onAfterImplode == "function") { _this.onAfterImplode(triggerNode, boxNode); }		});		if(typeof _this.onImploding == "function") {			dojo.event.connect(animHide, "onAnimate", this, "onImploding");		}	}	// trigger events	dojo.event.connect(triggerNode, "onclick", function(e) {		if(_this.showing) {			_this.hide();		} else {			_this.show();		}	});	dojo.event.connect(triggerNode, "onmouseover", function(e) {		if(_this.autoShow) {			_this.timeShow();		}	});	dojo.event.connect(triggerNode, "onmouseout", function(e) {		if(_this.autoHide) {			_this.timeHide();		}	});	// box events	dojo.event.connect(boxNode, "onmouseover", function(e) {		clearTimeout(hideTimer);	});	dojo.event.connect(boxNode, "onmouseout", function(e) {		if(_this.autoHide) {			_this.timeHide();		}	});	// document events	dojo.event.connect(document.documentElement || document.body, "onclick", function(e) {		function isDesc(node, ancestor) {			while(node) {				if(node == ancestor){ return true; }				node = node.parentNode;			}			return false;		}		if(_this.autoHide && _this.showing			&& !isDesc(e.target, boxNode)			&& !isDesc(e.target, triggerNode) ) {			_this.hide();		}	});	return this;};/**** 	Strategies for displaying/hiding objects	This presents a standard interface for each of the effects*****/dojo.fx.html.toggle={}dojo.fx.html.toggle.plain = {	show: function(node, duration, explodeSrc, callback){		dojo.style.show(node);		if(dojo.lang.isFunction(callback)){ callback(); }	},	hide: function(node, duration, explodeSrc, callback){		dojo.style.hide(node);		if(dojo.lang.isFunction(callback)){ callback(); }	}}dojo.fx.html.toggle.fade = {	show: function(node, duration, explodeSrc, callback){		dojo.fx.html.fadeShow(node, duration, callback);	},	hide: function(node, duration, explodeSrc, callback){		dojo.fx.html.fadeHide(node, duration, callback);	}}dojo.fx.html.toggle.wipe = {	show: function(node, duration, explodeSrc, callback){		dojo.fx.html.wipeIn(node, duration, callback);	},	hide: function(node, duration, explodeSrc, callback){		dojo.fx.html.wipeOut(node, duration, callback);	}}dojo.fx.html.toggle.explode = {	show: function(node, duration, explodeSrc, callback){		dojo.fx.html.explode(explodeSrc||[0,0,0,0], node, duration, callback);	},	hide: function(node, duration, explodeSrc, callback){		dojo.fx.html.implode(node, explodeSrc||[0,0,0,0], duration, callback);	}}dojo.lang.mixin(dojo.fx, dojo.fx.html);

⌨️ 快捷键说明

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