【发布时间】:2015-07-28 01:56:08
【问题描述】:
我有一个带有position: fixed 的 div,假设它应该附加到视口的底部而不是滚动,至少根据MDN。
相反,我得到的是一个 div,它停留在其初始位置(呈现页面时视口的底部),但随后使用 shadow-dom 滚动条上下滚动。
编辑:
这是一个带有核心支架内元素的代码笔。请注意,这支笔中的红色 div 具有 position: fixed ,如下面的代码所述。
http://codepen.io/ericeslinger/pen/bdedgp
这是一个带有核心支架外元素的代码笔。这是我想要的行为,但 div 在结构上位于核心脚手架内(出于角度范围的原因)。
http://codepen.io/ericeslinger/pen/jPrPyy
FWIW,我使用的是聚合物 0.5。这是我正在运行的草图:
<head>
<style type="text/css">
.testClass {
position: fixed;
z-index: 1000;
bottom: 0;
left: 0px;
right: 0px;
height: 150px;
background-color: red;
}
</style>
</head>
<body unresolved>
<core-scaffold>
<div main vertical layout>
<span>woo</span>
<div class="testClass">This is some stuff at the bottom</div>
<div style="min-height: 2000px" flex></div>
</div>
</core-scaffold>
如果我将 testClass div 移到 core-scaffold 之外,它会执行预期的操作并粘在窗口底部。如果我把它放在核心支架内,它不会。
【问题讨论】:
-
你能做个小提琴吗?
-
不幸的是,我不这么认为 - 我没有看到任何有效的聚合物小提琴、plunk、codepens 或你有什么:显然,他们在 CORS 和 CDN 方面存在问题。我会看看我能挖出什么。
-
啊哈,我在 codepen 上发现了。似乎有效,或者至少对我有效。
标签: css polymer shadow-dom