【发布时间】:2013-08-15 11:25:33
【问题描述】:
我有一个容器(主容器),当鼠标悬停在它上面时 - 在主容器附近显示新容器(添加容器)。将鼠标悬停在此容器(主容器和添加容器)上时,添加容器会停留在屏幕上。当鼠标移出主容器或添加容器时 - 添加容器隐藏。问题:在Opera添加容器中不停留在屏幕上。
HTML:
<div style='float:left; width:100px;' class='triggerShowHidePanel' panelID='1'>
--- main content ---
<div class='categoryContainer1' style='float:left; display:none; width:100px;'>
--- addition content ---
</div>
</div>
JS:
$('.triggerShowHidePanel').bind('mouseover', function() {
var positionX = $(this).position().top;
var positionY = $(this).position().left + 100;
$('.categoryContainer' + $(this).attr('panelID')).show();
$('.categoryContainer' + $(this).attr('panelID')).offset({
top: Math.round(positionX),
left: Math.round(positionY)
});
}).bind('mouseout', function() {
$('.categoryContainer' + $(this).attr('panelID')).hide();
$('.categoryContainer' + $(this).attr('panelID')).offset({ top: 0, left: 0 });
});
【问题讨论】:
-
你想要这种类型吗? jsfiddle.net/gUap5/1
-
"--- 附加内容 ---" 必须在屏幕上,而将鼠标悬停在主要内容或附加内容上。
标签: javascript jquery css opera