Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inspect Javascript Hover in Chrome Developer Tools

I have some Javascript which displays an element on hover. I want to style this element and therefore need to trigger the hover state in the browser using Chrome Dev Tools.

This is easy to do with CSS where you can set the state of an element within Dev Tools. What is the best way to do this with Javascript?

Code Example:

$('#menu').hover(     function() {         console.log('test');         $('#dropdown').show();     },      function() {         $('#dropdown').hide();     } ); 
like image 955
raison Avatar asked Aug 26 '14 16:08

raison


People also ask

How do I hover in Google Chrome developer tools?

To force an element into :hover state, right click it and select :hover . Additional tips on the elements panel in Chrome Developer Tools Shortcuts. Not sure when this changed, but you can now right click -> force element state (from the elements pane) on other elements (not just <a> elements) now.

How do I inspect JavaScript in Chrome?

Press the F12 function key in the Chrome browser to launch the JavaScript debugger and then click "Scripts". Choose the JavaScript file on top and place the breakpoint to the debugger for the JavaScript code.


1 Answers

Another alternative would be to hover over the element with your mouse and press F8 (this will only work in Chrome) to pause the script execution. The hover state will remain in visible to you.

like image 192
mrbut Avatar answered Sep 20 '22 20:09

mrbut