当前位置: 代码迷 >> Web前端 >> capture 与 unCapture 擒获在IE外的浏览器实现
  详细解决方案

capture 与 unCapture 擒获在IE外的浏览器实现

热度:382   发布时间:2012-11-09 10:18:47.0
capture 与 unCapture 捕获在IE外的浏览器实现
function syncScroll(){
	Hc.isCapture && overlayElement.setLocation(Hc.getScroll());
}

capture:Hc.isIE?function(target){
	if(Hc.captureTarget){
		Hc.unCapture();
	}
	(Hc.captureTarget = Hc.getDom(target)).setCapture();
	Hc.isCapture = true;
}:function(target/*,handle*/){
	Hc.isCapture = true;
	if(!overlayElement){
		overlayElement = Hc.getBody().on("scroll",syncScroll).createIn({
			cls:"hc-capture-overlay"
		},true);
	}
	/*
	2010-07-15 取消第2个参数
	handle = handle || target;
	if((handle = handle || target)!=cacheHandle){
		cacheHandle = handle;
		overlayElement.setStyle("cursor",Hc.fly(cacheHandle,"_capture").getStyle("cursor"));
	}
	*/
	if(target != cacheTarget){
		cacheTarget = target;
		cacheFly = Hc.fly(cacheTarget,"_capture");
		overlayElement.setStyle("cursor",cacheFly.getStyle("cursor"));
	}
	overlayElement.show();
	syncScroll();
	Hc.captureTarget = cacheFly.dom;
},
		
/**
*@getter 鼠标捕获的目标.
*/
captureTarget:null,
		
/**
*@getter 是否鼠标被捕获.
*/
isCapture:false,

/**
*解除捕获鼠标.
*/
unCapture:function(){
	if(Hc.captureTarget){
		Hc.isIE ? Hc.captureTarget.releaseCapture():overlayElement.hide();
		Hc.captureTarget = null;
		Hc.isCapture = false;
	}
},

?

  相关解决方案