Jquery 清除。当元素不为'时追加;不要在上空盘旋

Jquery 清除。当元素不为'时追加;不要在上空盘旋,jquery,hover,appendto,Jquery,Hover,Appendto,好的,所以我使用了.appendTo来解决溢出问题:隐藏,这样我的整个工具提示将显示在包含div的外部。但是,它在项目悬停后将工具提示锁定在适当的位置。如何清除.appendTo以隐藏工具提示 $(this).hover(function(){ var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight}); $(this).children('.brows

好的,所以我使用了.appendTo来解决溢出问题:隐藏,这样我的整个工具提示将显示在包含div的外部。但是,它在项目悬停后将工具提示锁定在适当的位置。如何清除.appendTo以隐藏工具提示

$(this).hover(function(){
var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height:        this.offsetHeight});
$(this).children('.browse-tip').css({top: -40, left: pos.left - pos.width / 2});
$(this).children('.browse-tip').show();
$(this).children('.browse-tip').appendTo('#browse_wrap');
},function() {
$(this).children('.browse-tip').hide();
});

事情的整体结构让你的工作充满挑战。我建议使用一个独立的元素,您可以在需要时在页面周围浮动切换,并在显示之前将相关信息放入其中:

<div id="popup"></div>

<style>
#popup {
    position: absolute;
    display: none;
    z-index: 999999;
    width: 220px;
    height: 200px;
}

#popup .browse-tip {
    display: block;
}
</style>

<script>
$(this).hoverIntent(function(){
    var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight});
    $(this).children('.browse-tip').clone().appendTo("#popup");
    $("#popup").css({top: pos.top-40, left: pos.left - pos.width / 2});
    $("#popup").show();
    return true;
},function() {
    $("#popup").hide().children().remove();
    return false;
});
</script>

#弹出窗口{
位置:绝对位置;
显示:无;
z指数:999999;
宽度:220px;
高度:200px;
}
#弹出。浏览提示{
显示:块;
}
$(this.hoverIntent(function()){
var pos=$.extend({},$(this.offset(),{width:this.offsetWidth,height:this.offsetHeight});
$(this).children('.browse-tip').clone().appendTo(“#popup”);
$(“#popup”).css({top:pos.top-40,left:pos.left-pos.width/2});
$(“#弹出窗口”).show();
返回true;
},函数(){
$(“#弹出”).hide().children().remove();
返回false;
});

如果您能了解其他内容以及“浏览”包装的进展情况,将非常有帮助。也许是个朋友?你让我很开心。谢谢你,先生。