var getOneDiv=function(){
var div=document.createElement("div");
div.style.position="absolute";
div.style.display="block";
div.style.zIndex="10";
div.style.background="yellow";
div.addEventListener("mouseout",function(event){//我把它加在了这里,而这里监听的判断与之前的划入几乎如出一辙
var x=event.clientX;
var y=event.clientY;
left=x-test.offsetLeft;
top=y-test.offsetTop;
right=test.offsetLeft+test.offsetWidth-x;
bottom=test.offsetTop+test.offsetHeight-y;
arr=[];
arr.push(top);
arr.push(right);
arr.push(bottom);
arr.push(left);
var least=findLeast(arr);
if(least==1){
}
if(least==2){//还是距离和宽度的同时改变啊
div.style.left=test.offsetLeft+"px";
div.style.top=test.offsetTop+"px";
div.style.height=test.offsetHeight+"px";
div.style.width=width+"px";
var changeWidth2=setInterval(function(){
if(div.offsetLeft>=test.offsetLeft+test.offsetWidth){
clearInterval(changeWidth2);
check=true;//关键点
}else{
marginLeft=marginLeft+10;
width=width-10;
div.style.width=width+"px";
div.style.left=marginLeft+"px";
}
},30);
}
if(least==3){
}
if(least==4){//向左划出,width作为全局变量,这次就是不断减小了
div.style.left=test.offsetLeft+"px";
div.style.top=test.offsetTop+"px";
div.style.height=test.offsetHeight+"px";
div.style.width=width+"px";
var changeWidth1=setInterval(function(){
if(div.offsetWidth<=0){
clearInterval(changeWidth1);
check=true;//这里也比较关键哦
}else{
width=width-10;
div.style.width=width+"px";
}
},30);
}
})
return div;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有