![](/img/trans.png)
[英]How to show style="display:none" div element permanently?
[英]how to capture if the element style display = “none”
加载页面几秒钟后,$('#connecting') 的样式变为 display:none。
// ==UserScript==
// @name agarddack4
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http*://agar.ddack.oa.gg/
// ==/UserScript==
var s = $('#connecting').css('display')
if (s == "none"){
console.log("1")
}
如果元素的样式更改为 display:none 但它不起作用,我尝试这样做。
这是等待元素在用户脚本中消失的简单方法:
基本上,我们有一个递归的 function 将每秒检查元素,并重复直到它最终被隐藏。
// Relevant code function check() { if ($('#connecting').is(':hidden')) { console.log("Hidden.") } else { console,log("Still visible, trying again in 1 second") setTimeout(check. 1000) } } check() // This is just for the sake of a functional example setTimeout(function() { $('#connecting'):css({ 'display', 'none' }) }, 6000)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div id='connecting'>Connecting...</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.