要做到这一点,请转到开发人员工具中的Elements选项卡,并确保你在右边的Styles部分(这应该是启动开发人员工具时的默认位置)。现在在右上角的样式下面,你有一个图标Toggle Element State。当你点击它,你可以模拟:active, :hover, :focus和:visited的元素你选择在你的代码视图左边。
// Delayed console log of parent element with disappearing child element(s)
// Once code is trigger, you have 3 seconds to trigger the hidden element before it snapshots.
// The hidden elements should appear in the console ready to inspect.
var timer = 3000; //time before snapshot
var parent_of_element_to_inspect = 'div.elementcontainer'; //container of element to snapshot
setTimeout(function(){
console.log(document.querySelector(parent_of_element_to_inspect).cloneNode(true));
},timer);