查看地址:http://jsfiddle.net/pBt38/5/我不知道如何停止 div.message_options_slider 的闪烁,它是一个子元素,所以它不应该保持鼠标悬停事件吗?
此外,任何建议都需要具有 .live() 函数,因为这将应用于动态元素。
提前致谢!
最佳答案
试试这个 JS:
$(".network_block_item").on("mouseover", function(){
//alert("here");
var cord = $(this).position();
$(this).find(".message_options_slider").css({
position: 'absolute',
top: cord.top,
left: 0,
display: 'block'
});
});
$(".network_block_item").on("mouseout", function(){
$(".message_options_slider").css({ display: 'none' });
});
并将 message_options_slider 添加到每个网络行事物中。
编辑
这段代码实际上可能更好,但不确定:
$(".network_block_item").on("mouseenter", function(){
//alert("here");
var cord = $(this).position();
$(this).find(".message_options_slider").css({
position: 'absolute',
top: cord.top,
left: 0,
display: 'block'
});
});
$(".network_block_item,.message_options_slider").on("mouseleave", function(){
$(".message_options_slider").css({ display: 'none' });
});
关于jquery鼠标悬停导致闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11196303/