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

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

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


当前回答

我发现这在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

要能够检查任何元素,请执行以下操作。这应该工作,即使很难复制悬停状态:

Run the following javascript in the console. This will break into the debugger in 5 seconds. setTimeout(function(){debugger;}, 5000) Go show your element (by hovering or however) and wait until Chrome breaks into the Debugger. Now click on the Elements tab in the Chrome Inspector, and you can look for your element there. You may also be able to click on the Find Element icon (looks like a magnifying glass) and Chrome will let you go and inspect and find your element on the page by right clicking on it, then choosing Inspect Element

请注意,这种方法与本页上的另一个很棒的答案略有不同。

更新: 正如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和时间,如果你明白了。

我试过其他的解,它们都有效,但我很懒,所以这就是我的解

将鼠标悬停在元素上以触发展开状态 ctrl + shift + c 再次悬停在元素上 右击 导航到调试器

通过右键点击它不再注册鼠标事件,因为一个上下文菜单弹出,所以你可以安全地移动鼠标

以前我的Chrome冻结功能不工作按f8快捷键,我使用这个走动,去源选项卡,只需点击暂停/播放脚本执行按钮在Chrome开发工具在源选项卡的右面板,我的快捷键得到了修复,并从那时开始工作,真的感谢充分,修复了我的问题