我想看到:hover样式的锚,我在Chrome中徘徊。在Firebug中,有一个样式下拉菜单,允许我为一个元素选择不同的状态。

我似乎在Chrome中找不到任何类似的东西。我遗漏了什么吗?


当前回答

使用JS可以触发元素上的MouseEvent。下面是如何对悬停进行操作。

使用右键单击检查元素。 像这样复制JS路径 在Sources Chrome DevTools中按“Esc”键打开控制台。 然后粘贴复制的路径,并添加.dispatchEvent(new MouseEvent('mouseover', {'bubbles': true}));是这样的: 按enter键,然后可以与悬停状态后发生的任何DOM更改进行交互。

其他回答

我知道我所做的是相当的变通,但它工作完美,这是我每次都做的方式。

然后,像这样进行:

首先确保Chrome开发工具是未停靠的。 然后,将Dev Tools窗口的任意一侧移动到你想要检查的元素中间。

最后,悬停元素,右键单击并检查元素,将鼠标移动到开发工具窗口,你将能够玩你的元素:悬停css。

干杯!

如果有帮助的话,这在最新的Chrome(47.0.2526.106)中似乎更容易:

检查元素,然后单击左侧排水沟中的三个白点:

然后从下拉菜单中选择所需的元素状态:

我认为这在Chrome中不再是一个问题,只是以防万一。我写了这个jQuery脚本,当我用TAB键移动时检查DOM。

如果更改为使用'mouseover',将看起来像这样:

$("body *").on('mouseover', function(event) {       
    console.log(event.target);      
    inspect(event.target);
    event.stopPropagation();
});

您可以轻松地修改它,以便在单击或对想要停止的元素进行操作时删除事件处理程序。

有几种方法可以在Chrome开发工具中查看HOVER STATE样式。

方法1

方法2

与Firefox默认开发者通行费

与Firebug

It's also possible that the code can be hidden in the database and there is no actual file containing it. A client of mine has the "Travelify" theme by Colorlib and some of the options from the WP admin GUI write directly to the DB and the DB generates the css code on the fly - I can see the css in html source but nowhere in any actual files. This drove me crazy and took me awhile to figure out. There's a great DB search tool for WP called "Search and Replace" by Inpsyde GmbH that I have found to be invaluable. Be careful with it of course!

干杯!