草庐IT

indexed_document

全部标签

html - 负 z-index 有副作用吗

我一直在寻找我的问题的答案:Doesnegativez-indexhaveanysideeffects我之前已经在这里问过:Doesnegativez-indexaffectperformanceorcompatibility?但它没有得到足够的重视(可能是因为我把东西混了一点)我想尝试用另一种方式提问。我正在开发跨平台(不同浏览器、设备)的Web应用程序,有时我需要为z-index属性使用负值,但我担心它是否会对任何/某些浏览器并破坏兼容性。我希望我把问题说清楚了:) 最佳答案 在Chrome1.0、FireFox3.0、IE4.

javascript - document.hidden 与 document.hasFocus() 之间的区别

请解释document.hidden、HTML5页面可见性API和document.hasFocus()之间的区别。我正在做一个项目,该项目在选项卡未聚焦时弹出HTML5桌面通知。我有点困惑该使用哪个。 最佳答案 hiddenattribute定义如下:Ongetting,thehiddenattributeMUSTreturntrueiftheDocumentcontainedbythetoplevelbrowsingcontext(rootwindowinthebrowser'sviewport)isnotvisibleatal

html - Z-Index 不适用于 Safari - 在 Firefox 和 Chrome 上正常

Z-index在Safari上无法正确呈现-但它在Chrome和Firefox上运行良好。我无法弄清楚Safari特定的错误是什么。相关代码如下:.flex-container{display:inline-flex;align-items:center;justify-content:center;}.flex-item{margin-left:14%;}#inner-ul2{margin-left:70px;}#inner-navbar{z-index:1;background-color:white;overflow:hidden;margin-top:50px;box-shad

javascript - 通过 document.write() 添加一个简单的静态 <style> 标签的原因是什么?

我刚刚看了一个randomapppage的页面源码在apptivate.ms上并在中注意到这个JavaScript:document.write(".app-description{max-height:600px}");它在客户端显然是完全静态的,所以我想知道有什么用例。由于他们的StackExchange开发人员(支持apptivate.ms)非常聪明,我确定有一些原因,但我无法弄清楚是哪个。我想这与延迟规则在整个文档加载之前生效有关,但我希望一旦浏览器“看到”新标签就应用该规则... 最佳答案 因为.app-descripti

javascript - 在 Chrome 控制台中修改 document.cookie 不起作用

我可以在Chrome开发者工具的控制台修改document.cookie吗?我当前的cookie字符串是这样的:"coldcookie="如果我在下面运行这段代码,它似乎就不起作用了:document.cookie=document.cookie+";newcookie=something"document.cookie根本不会改变。更新:我发现如果我运行:document.cookie="newcookie"它实际上在cookie字符串中添加了一个“newcookie”,如:"oldcookie=;newcookie"不是应该清除当前的cookie字符串吗?它在IE中做同样的事情。所

html - 为什么 "z-index"不适用于具有转换 : translateY() 的元素

下面是片段:.up{background-color:red;height:100px;z-index:100;}.down{background-color:yellow;height:100px;width:50%;margin:0auto;z-index:1;transform:translateY(-50%);}可以看出,.up元素的z-index高于.down元素。但是,.down元素仍然以某种方式位于.up元素的前面。有人对此有想法吗?如何解决这个问题? 最佳答案 要使z-index起作用,position必须应用为ab

javascript - 为什么 $(document).ready();不明确的?

我以为我做的一切都是对的,但是我总是收到这个错误。$(文档).ready();//在控制台中未定义。我导入了我的jquery脚本。$(document).ready(function(){$("div#chat").hide();});functionsend_file(){}functionremove_selected(){}functionchangeToFile(){}functionchatToProfile(){}functionchangeToChat(){} 最佳答案 如果您在本地运行此文件(我怀疑您是...),这将

javascript - 为什么在 `new Document` 下创建的元素包含错误的原型(prototype)?

当创建一个div时,它是HTMLDivElement的一个实例:vard=document.createElement('div');dinstanceofHTMLDivElement;//truedinstanceofElement;//true获取外部文档和窗口也是如此:varframe=document.createElement('iframe');document.body.appendChild(frame);vardoc2=frame.contentWindow.document;vard2=doc2.createElement('div');d2instanceoffr

html - 如何在固定元素的子元素中建立新的根级别 z-index?

鉴于以下HTML:#header{position:fixed;z-index:1;background-color:red;width:100%;height:150px;top:0;}#drop{position:absolute;top:5px;width:100px;background-color:green;height:400px;z-index:3;}#footer{position:fixed;z-index:2;background-color:blue;width:100%;height:150px;bottom:0;}我如何修改仅CSS,所以#drop#head

javascript - 在 JavaScript 中获取 DIV 的 z-index?

我有一个divnormaldiv1类normaldiv。我试图通过样式属性访问它的z-index,但它总是返回0,尽管它在样式表中设置为2。CSS:.normaldiv{width:120px;height:50px;background-color:Green;position:absolute;left:25px;top:20px;display:block;z-index:2;}`HTML:JavaScript:alert(document.getElementById('normaldiv1').style.zIndex);如何使用JavaScript查找元素的z-index?