【问题标题】:how to create a box similar to stackoverflow, click to dismiss如何创建一个类似于stackoverflow的框,点击关闭
【发布时间】:2009-05-13 20:14:26
【问题描述】:

重复:How would I implement StackOverflow's hovering dialogs?


我正在尝试创建一条正在显示的错误消息,到目前为止这是一个粗略的尝试,消息显示正常,但是点击不起作用..

function message(somemessage){
       $(document).ready(function(){
            $('<div class="error">' + somemessage+ '</div>')
           .insertAfter( $('#ErrorMessage') ).fadeIn('slow').animate({opacity: 1.0}, 5000).click(function(){$(this).remove});
   });
 }

【问题讨论】:

    标签: jquery dialog


    【解决方案1】:

    我已经在this question 中回答了如何做到这一点。

    如果需要,直接跳到example.

    但是,如果您想要更强大的东西,您应该查看许多解决方案:

    如果您想了解如何执行本网站中使用的其他通知(当您获得新徽章时位于顶部的通知等),您可以在this question 中查看如何执行此操作。

    【讨论】:

      【解决方案2】:

      不是因为remove函数后面忘记加括号了吗?

      试试这个

      $('<div class="error">' + "somemessage"+ '</div>')
                 .insertAfter( $('#ErrorMessage') ).fadeIn('slow').
      animate({opacity: 1.0}, 5000).click(function(){$(this).remove()});
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-01-21
        • 2011-09-07
        • 1970-01-01
        • 2011-05-20
        • 2023-03-24
        • 1970-01-01
        • 2012-07-09
        • 1970-01-01
        相关资源
        最近更新 更多