Is there a way to tell Chrome web debugger to show the current mouse position in page coordinates?

后端 未结 3 1170
不思量自难忘°
不思量自难忘° 2021-01-29 21:18

I often debug my javascript code using the Chrome web debugger. In the elements tab, hovering over an element show a tooltip with a few pieces of information, including the widt

3条回答
  •  不要未来只要你来
    2021-01-29 22:00

    Combining ppsreejith's answer with JHarding's answer with Chrome 70+'s Live Expressions you can get constantly updating (x, y) coordinates without filling up the devtools console:

    Enter this in the console:

    var x, y; document.onmousemove=(e)=>{x=e.pageX;y=e.pageY;}
    

    Enter this as a Live Expression:

    "("+x+", "+y+")"
    

    And this works on SVGs.

提交回复
热议问题