这个是我模仿做的一个鼠标放上去显示详细的一个js程序
效果如下:http://www.dalianfang.com/jsdemo/default6.html
代码查看源文件可见
现在有两个问题
1)我鼠标放上去有抖动的效果,也就是说,我把鼠标放在弹出层上,底下层的onmousever事件也被触发了
2)想做一个弹出的详细层的时候有一个过渡的效果
http://community.csdn.net/Expert/topic/5571/5571620.xml?temp=5.099124E-02谁帮着解决对了200分重谢!
效果如下:http://www.dalianfang.com/jsdemo/default6.html
代码查看源文件可见
现在有两个问题
1)我鼠标放上去有抖动的效果,也就是说,我把鼠标放在弹出层上,底下层的onmousever事件也被触发了
2)想做一个弹出的详细层的时候有一个过渡的效果
http://community.csdn.net/Expert/topic/5571/5571620.xml?temp=5.099124E-02谁帮着解决对了200分重谢!
解决方案 »
- 急!!!!怎么把后台数据在ssh框架下传到jsp页面,用的ajax。。
- jquery datepicker 日历控件问题
- script的属性src跨域问题
- 两种定义对象的方式有何区别?
- JSON解析,求高手
- 为什么这个函数只能用数字开头
- 高分请教 javascript 事件捕捉问题!
- 怎样用脚本实现:根据屏幕的分辨率设置<object width=xx height=yy></object>中的宽和高?
- 父窗口中window.open打开一个子窗口,在子窗口中能否调用父窗口的js函数?
- vue中使用vue-resourse把json数据渲染出来时报错
- [求助]一个JSP页面中的javascript如何调用另一个JSP页面的javascript
- 请问ie后退按钮所触发的javascrip改怎么写??
/*set position */
function getposOffset(over_forshow, offsettype){
var totaloffset=(offsettype=="left")? over_forshow.offsetLeft : over_forshow.offsetTop;
//totaloffset根据参数取得距离左边或上边的高度距离
var parentEl=over_forshow.offsetParent;
//offsetParent 属性指定的父坐标的高度或长度
//offsetTop 指 obj 距离上方或上层控件的位置,整型,单位像素
//obj.offsetLeft 指 obj 距离左方或上层控件的位置,整型,单位像素。//obj.offsetWidth 指 obj 控件自身的宽度,整型,单位像素。//obj.offsetHeight 指 obj 控件自身的高度,整型,单位像素。while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft: totaloffset+parentEl.offsetTop;
//如果是x,left,左边的位置+
parentEl=parentEl.offsetParent;
}
return totaloffset;
}/*on mouse over event */function over_forshow(curobj, subobjstr){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
var subobj2=document.getElementsByTagName(subobjstr)
var s = "block";
closeall();
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")-(subobj.offsetWidth-curobj.offsetWidth);
var ypos=getposOffset(curobj, "top")+curobj.offsetHeight
subobj.style.left=xpos+"px"
subobj.style.top=170+"px"//you can resize the num to adjust the position
//alert(xpos)
subobj.style.zindex=9;
curobj.style.zindex=5;return false
}
else
return true
}function over_forshowclose(subobj){
document.getElementById(subobj).style.display="none"
}/*close all the layer of the details*/
function closeall(){ for(i=1;i<=4;i++) //replace the num"4" to your num(itmes counts)
{
document.getElementById("showdetails"+i).style.display="none"
}
}
</SCRIPT>
/*set position */
function getposOffset(over_forshow, offsettype){
var totaloffset=(offsettype=="left")? over_forshow.offsetLeft : over_forshow.offsetTop;
//totaloffset根据参数取得距离左边或上边的高度距离
var parentEl=over_forshow.offsetParent;
//offsetParent 属性指定的父坐标的高度或长度
//offsetTop 指 obj 距离上方或上层控件的位置,整型,单位像素
//obj.offsetLeft 指 obj 距离左方或上层控件的位置,整型,单位像素。//obj.offsetWidth 指 obj 控件自身的宽度,整型,单位像素。//obj.offsetHeight 指 obj 控件自身的高度,整型,单位像素。while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft: totaloffset+parentEl.offsetTop;
//如果是x,left,左边的位置+
parentEl=parentEl.offsetParent;
}
return totaloffset;
}/*on mouse over event */function over_forshow(curobj, subobjstr){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
var subobj2=document.getElementsByTagName(subobjstr)
var s = "block";
closeall();
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")-(subobj.offsetWidth-curobj.offsetWidth);
var ypos=getposOffset(curobj, "top")+curobj.offsetHeight
subobj.style.left=xpos+"px"
subobj.style.top=170+"px"//you can resize the num to adjust the position
//alert(xpos)
subobj.style.zindex=9;
curobj.style.zindex=5;return false
}
else
return true
}function over_forshowclose(subobj){
document.getElementById(subobj).style.display="none"
}/*close all the layer of the details*/
function closeall(){ for(i=1;i<=4;i++) //replace the num"4" to your num(itmes counts)
{
document.getElementById("showdetails"+i).style.display="none"
}
}
</SCRIPT>
如果要显示那个是display=""就返回
否则就display=""
上面的层出现的时候移除下面层的onmousever
element.detachEvent("onmousever",functionName);
上面的层消失的时候再加回来
element.attachEvent("onmousever",functionName);