我正在使用chrome检查器尝试分析twitter引导弹窗的z-index,并发现这非常令人沮丧……

是否有一种方法来冻结弹窗(而显示),以便我可以评估和修改相关的CSS?

在相关链接上放置固定的“悬停”不会导致弹出窗口出现。


当前回答

更新: 正如Brad Parks在他的评论中所写的,有一个更好更简单的解决方案,只需要一行JS代码:

运行setTimeout(function(){debugger;},5000);,然后显示你的元素并等待它进入调试器


最初的回答:

我只是遇到了同样的问题,我想我找到了一个“通用”的解决方案。(假设站点使用jQuery)

Go to elements tab in inspector Right click <body> and click "Edit as HTML" Add the following element after <body> then press Ctrl+Enter: <div id="debugFreeze" data-rand="0"></div> Right click this new element, and select "Break on..." -> "Attributes modifications" Now go to Console view and run the following command: setTimeout(function(){$("#debugFreeze").attr("data-rand",Math.random())},5000); Now go back to the browser window and you have 5 seconds to find your element and click/hover/focus/etc it, before the breakpoint will be hit and the browser will "freeze". Now you can inspect your clicked/hovered/focused/etc element in peace.

当然,你可以修改javascript和时间,如果你明白了。

其他回答

更新: 正如Brad Parks在他的评论中所写的,有一个更好更简单的解决方案,只需要一行JS代码:

运行setTimeout(function(){debugger;},5000);,然后显示你的元素并等待它进入调试器


最初的回答:

我只是遇到了同样的问题,我想我找到了一个“通用”的解决方案。(假设站点使用jQuery)

Go to elements tab in inspector Right click <body> and click "Edit as HTML" Add the following element after <body> then press Ctrl+Enter: <div id="debugFreeze" data-rand="0"></div> Right click this new element, and select "Break on..." -> "Attributes modifications" Now go to Console view and run the following command: setTimeout(function(){$("#debugFreeze").attr("data-rand",Math.random())},5000); Now go back to the browser window and you have 5 seconds to find your element and click/hover/focus/etc it, before the breakpoint will be hit and the browser will "freeze". Now you can inspect your clicked/hovered/focused/etc element in peace.

当然,你可以修改javascript和时间,如果你明白了。

我发现这在Chrome上运行得非常好。

右键单击要检查的元素,然后单击强制元素状态>悬停。截图。

让它工作。以下是我的步骤:

Browse to the desired page Open the dev console - F12 on Windows/Linux or option + ⌘ + J on macOS Select the Sources tab in chrome inspector In the web browser window, hover over the desired element to initiate the popover Hit F8 on Windows/Linux (or fn + F8 on macOS) while the popover is showing. If you have clicked anywhere on the actual page F8 will do nothing. Your last click needs to be somewhere in the inspector, like the sources tab Go to the Elements tab in inspector Find your popover (it will be nested in the trigger element's HTML) Have fun modifying the CSS

没有一个解决方案对我有效,只有如下所述: https://developer.chrome.com/docs/devtools/javascript/disable/

对于Linux (Mac使用命令代替控制):

打开开发工具(ctrl + shift + I) 运行命令窗口(ctrl + shift + P) 开始输入javascript并选择禁用javascript

说明截图:

右键单击元素标签中的任意位置 选择Breakon……>子树修改 触发你想要看到的弹出窗口,如果它在DOM中看到变化,它就会冻结 如果你仍然没有看到弹出框,在chrome顶部中心的Resume(F8)旁边点击Step over下一个函数(F10)按钮,直到你冻结你想看到的弹出框。