javascript - 如何在段落淡入后立即淡出该段落?

标签 javascript jquery html

这是我的功能:

function showGeneralWarning(msg) {
    if (getIDQuantity("generalWarning") < 1) { 
        $("#Warnings").append('<p id="generalWarning" class="alert alert-danger" style="display: none;">' + msg + '</p>');
        $("#generalWarning").fadeIn('slow').animate({opacity: 1.0}, 100).effect("pulsate", { times: 5 }, 1000);
        $("#generalWarning").fadeOut('slow').animate({opacity: 1.0}, 100).effect("pulsate", { times: 5 }, 1000);
    }
}

它完美地淡入,但它永远留在那里(它永远不会淡出并消失)。

最佳答案

这是一个简单的例子,希望它是您想要的 $('.fadein').hide().fadeIn('slow').delay(800).fadeOut('slow'); https://jsfiddle.net/3spc9541/

有关链接的更多信息 http://www.w3schools.com/jquery/jquery_chaining.asp

关于javascript - 如何在段落淡入后立即淡出该段落?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34002143/

相关文章:

javascript - 渲染作为 prop 传递的 React 元素时遇到问题

javascript - 使用 XMLHttpRequest 将多个文件上传到 Express.js 3.5 服务器

javascript - 加载electron渲染器时,http ://and file://?之间的require有什么不同

jquery - 设置下拉列表中第一个选项的数据

jquery - 如何在 highstock 中配置具有特定高度的图例?

html - 在 HTML 属性中,何时使用逗号,何时使用空格

javascript - 将 2 个 JavaScript 变量的内容交换为另一个

javascript - 如何使用 JavaScript 确认对话框菜单触发表单提交事件

html - 在同一个标​​签内,文本向左,图像向右

html - 将顶部的 div 粘贴到浏览器选项卡的顶部