【问题标题】:Auto refeashing DIv cause jquery inside div not to work自动重新刷新 DIv 导致 div 内的 jquery 不起作用
【发布时间】:2011-06-24 00:37:07
【问题描述】:

我有以下代码

// hover show delete and refer button
    $('.friendsArea').livequery("mouseenter", function(e){
        $(this).children("a.delete").show();            
        $("a.PostShowHide_link", this).show();                      
    }); 

    // mouseout hide delete and refer button
    $('.friendsArea').livequery("mouseleave", function(e){
        $('a.delete, a.PostShowHide_link').hide();  
    }); 

在鼠标悬停和鼠标移出时显示和隐藏记录列表的链接

我正在开发类似于 Facebook 和 Twitter 的自动刷新 我正在使用下面的这段代码来刷新以将内容加载到 div 中并刷新它

var auto_refresh = setInterval(
    function (){
    $('#posting').load('posts.php').fadeIn("slow");
    }, 10000); // refresh every 10000 milliseconds  
});

但是,当上述代码刷新 div 时,用于在鼠标悬停时显示的链接不再显示

【问题讨论】:

  • #posting 是否接收 .friendsArea 类的元素?
  • #posting 是刷新后的主 div,它包含各个帖子 .friendsArea 包含各个链接

标签: jquery html refresh


【解决方案1】:

解决了它而不是使用“.livequery()”我恢复使用 .live() 现在所有 jquery 都可以工作了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-05
    • 1970-01-01
    • 2013-09-01
    • 1970-01-01
    相关资源
    最近更新 更多