开发者

Firebug: How can I inspect an element I can't click on?

开发者 https://www.devze.com 2023-03-15 20:05 出处:网络
I\'m trying to use Firebug to inspect a page element that appears when I hover over a photo. Problem is, the element\'s position is dynamically offset from the mouse position, so it\'s impossible for

I'm trying to use Firebug to inspect a page element that appears when I hover over a photo.

Problem is, the element's position is dynamically offset from the mouse position, so it's impossible for me to right-click on it to get the "Inspect E开发者_StackOverflow社区lement" option.

I had hoped that the onhover element would be inserted into the DOM in a sensible place, but so far, I haven't been able to find it.

Any suggestions?


If you know where in the DOM the new element will be created (quite often those elements are created as children of the body element) you can set up a breakpoint for when it is created.

Let's assume that the element will be created as a child of the body element. You will be able to inspect the element if you follow these steps:

  1. Load the page
  2. activate FireBug's HTML panel
  3. Locate the body element
  4. Right-click on the body element and choose Break on Child Addition or Removal from the popup menu
  5. Go hover over your photo to trigger the wanted element's creation

Script execution should then break as soon as the element is created. At that point you will have all the time you need to inspect that dynamically created element, even in the HTML panel.


This isn't an ideal solution, but you could investigate the onhover code to find out more information about the element that's being created. That info might allow you to find it in Firebug's DOM viewer.


Can you search for the element using the search bar at the top of the firebug window?


You can use CTRL+F to find it in the code view.

0

精彩评论

暂无评论...
验证码 换一张
取 消