firefox - 是否可以在 Firefox 中看到图层?

标签 firefox devtools firefox-quantum

如何在 Firefox 中获得与 Chrome devtools 的 Layers 选项卡相同或相似的效果?

我想查看页面上存在哪些图层及其尺寸。

看起来 FF 有这样的功能( "3D view" )但它已停产。

我找到并尝试使用 http://mozilla.github.io/layerscope/但这似乎不是我要找的东西,我不确定它是否在 FF Quantum 上正常工作。

最佳答案

您可以在控制台中运行这段 javascript。归功于克里斯·普莱斯。查看他的文章 a Webkit DOM Visualizer .

void function(b,p){function l(k,c,b,e,g,d,f){return"<div style='position:absolute;-webkit-transform-origin: 0 0 0;"+("background:"+f+";")+("width:"+e+"px; height:"+g+"px;")+("-webkit-transform:"+("translate3d("+k+"px,"+c+"px,"+b+"px)")+("rotateX(270deg) rotateY("+d+"deg)")+";")+"'></div>"}function o(k,c,d,f){for(var j=k.childNodes,n=j.length,m=0;m<n;m++){var a=j[m];if(1===a.nodeType){a.style.overflow="visible";a.style.WebkitTransformStyle="preserve-3d";a.style.WebkitTransform="translateZ("+(b+(n-
m)*q).toFixed(3)+"px)";var h=d,i=f;a.offsetParent===k&&(h+=k.offsetLeft,i+=k.offsetTop);o(a,c+1,h,i);e+=l(h+a.offsetLeft,i+a.offsetTop,(c+1)*b,a.offsetWidth,b,0,g[c%(g.length-1)]);e+=l(h+a.offsetLeft+a.offsetWidth,i+a.offsetTop,(c+1)*b,a.offsetHeight,b,270,g[c%(g.length-1)]);e+=l(h+a.offsetLeft,i+a.offsetTop+a.offsetHeight,(c+1)*b,a.offsetWidth,b,0,g[c%(g.length-1)]);e+=l(h+a.offsetLeft,i+a.offsetTop,(c+1)*b,a.offsetHeight,b,270,g[c%(g.length-1)])}}}var g="#C33,#ea4c88,#663399,#0066cc,#669900,#ffcc33,#ff9900,#996633".split(","),
q=0.001,e="",d=document.body;d.style.overflow="visible";d.style.WebkitTransformStyle="preserve-3d";d.style.WebkitPerspective=p;var r=(window.innerWidth/2).toFixed(2),s=(window.innerHeight/2).toFixed(2);d.style.WebkitPerspectiveOrigin=d.style.WebkitTransformOrigin=r+"px "+s+"px";o(d,0,0,0);var f=document.createElement("DIV");f.style.display="none";f.style.position="absolute";f.style.top=0;f.innerHTML=e;d.appendChild(f);var j="NO_FACES";document.addEventListener("mousemove",function(b){if("DISABLED"!==
j){var c=b.screenX/screen.width,b=(360*(1-b.screenY/screen.height)-180).toFixed(2),c=(360*c-180).toFixed(2);d.style.WebkitTransform="rotateX("+b+"deg) rotateY("+c+"deg)"}},!0);document.addEventListener("mouseup",function(){switch(j){case "NO_FACES":j="FACES";f.style.display="";break;case "FACES":j="NO_FACES",f.style.display="none"}},!0)}(25,5E3);

关于firefox - 是否可以在 Firefox 中看到图层?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47558844/

相关文章:

r - 使用 devtools::install_github() 安装 R 包时无法锁定目录

r - 为什么 devtools 给我一个警告,@slot 需要名称和描述

javascript - 脚本未在 Firefox 中运行,但在 Chrome 中运行

html - SVG 在 Firefox 18 中不工作

html - 如果元素的高度小于 32px,Firefox 会隐藏垂直滚动条

r - 在 RStudio 中为 R CMD 构建启用小插图压缩

css - 在导航栏悬停时显示 firefox 57 标签栏

Firefox 选择深色/浅色主题的页面操作图标

html - Div 不以某些浏览器为中心

javascript - 使用 JS 在 Firefox 中禁用 HTML5 视频的键盘事件