Note: I\'ve read similar threads, but none quite my issue - I can right click on it fine, it just then disappears.
I find \"Inspect Element\" an invaluable tool in C
Not sure if it was present in previous browser revisions, but I just found out this extremely simple method.
Open the inspector in chrome or Firefox, right click on the element you are interested in, and select the appropriate option (in this case: hover). This will trigger the associated CSS.
Screenshots from Firefox 55 and chromium 61.
If the hover
effect is given with CSS
then yes, I normally use two options to get this:
One, to see
the hover effect
when the mouse leave the hover area
:
Open the inspector in docked window and increase the width until reach your HTML element
, then right click and the popup menu must be over the inspector zone... then when you move the mouse over the inspector view, the hover effect
keep activated in the document.
Two, to keep
the hover effect
even if the mouse is not over the HTML element
, open the inspector, go to Styles TAB
and click in the upper right icon that says Toggle Element State
...(dotted rectangle with an arrow) There you can manually activate the Hover Event
(among others) with the checkbox provided.
If it's not clear at all, let me know and I can add a few screenshots.
Edited: screenshot added.
And finally and as I say at the begining, I only be able to do this if the hover
is set with CSS:HOVER
... when you control the hover state
with jQuery.onMouseOver
for example, only works (sometimes), the method One.
Hope it helps.
You can also do this in the javascript console:
$('#foo').trigger('mouseover');
An that will "freeze" the element in the "hover" state.
I needed to do this, but the element I was trying to inspect was added and removed dynamically based on hover state of another element. My solution is similar to this one, but that didn't quite work for me.
So here's what I did:
mouseover
of the element that triggers the hover event you're concerned about.$(document).on('mouseover', '[your-hover-element-selector]', function(e) {
debugger;
});
Once you do that, your DOM will be paused in the hover state, and you can use the element inspector to inspect all the elements as they exist in that state.
change the CSS so that the property which hides the menu isn't applied while you work on it is what I do.
Excellent stuff!
Thank you to gmo for that advice. I did not know about those attribute settings massively helpful.
As a small revision to the wording I would explain that process as follows:
Right Click on the element you would like to style
Open 'Inspect' tool
On right hand side, navigate to the small Styles tab
Found above CSS stylesheet contents
Select the .hov option - This will give you all the settings available for the selected HTML element
Click and Change all options to be inactive
Now Select the state that you would like to tweak - On activation of any of these, your Stylesheet will jump you directly to those settings:
Styles - Tweaking Filters - Interactive elements
This information was a lifesaver for me, cannot believe I have just heard about it!