[英]Delay popup loading after click
All I need it to do is delay the popup from "popping" for a few seconds after clicking a button.我需要做的就是在单击按钮后将弹出窗口从“弹出”延迟几秒钟。 Is there anything wrong with this code?这段代码有什么问题吗?
$(document).ready(function() { $('#element-167 a').on("click", function() { $('.modal-dialog').delay(5000).fadeIn(); }); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
Try using setTimeout尝试使用 setTimeout
$(document).ready(function() {
$('#selected').on("click", function() {
setTimeout(()=>{alert("Message here")},5000)
});
});
<p id="selected">This is second paragraph.</p>
Try to remove the "on" and just the element.click for instance:尝试删除“on”,仅删除 element.click 例如:
$('#element-167 a').click (function() {})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.