gpt4 book ai didi

polymer 在所有 child 身上泛起涟漪

转载 作者:行者123 更新时间:2023-12-04 15:44:09 28 4
gpt4 key购买 nike

我正在使用 Polymer做一个网站。我目前在使用 paper-ripple 时遇到一些问题.现在我遇到的问题是点击 h2 时没有出现波纹。或 h3 ,即使删除 <div class='description'> -tag,它是关闭标签。看尺寸paper-ripple ,它涵盖了整个<div class='album-header'> ,所以这应该不是问题。

此外,单击 <div class='description'> 下方的,在填充区域,也会产生波纹。

<div class="album-header" vertical layout on-tap="{{albumTapped}}">
<paper-ripple class="recenteringTouch" fit></paper-ripple>
<content select="img"></content>
<div class="description">
<content select="h2"></content>
<content select="h3"></content>
</div>
</div>

编辑:

我做了一些进一步的测试,并缩小了问题的范围。看看 this例子。将样式应用于子元素不会产生任何问题,除非您还指定了不透明度。在链接中给出的示例中,绿色文本已被赋予不透明度。单击此文本不会为我产生涟漪(在 Chrome 36 中运行)。 (绿色的分配与它无关,只是为了更容易发现)。点击周围的任何地方 <h3>标签确实使涟漪发生。

最佳答案

你只需要增加 z-index在外容器上,所以所有 <content>会低于它。例如:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<link rel='import' href='http://www.polymer-project.org/0.8/components/paper-ripple/paper-ripple.html'>
<script>console.clear()</script>
</head>
<body>
<style>
album-small {
width: 200px;
margin: 10px;
}
</style>

<div layout horizontal>
<album-small>
<h2>The Shatner</h2>
<h3>An interminable rambling spoken word piece.</h3>
</album-small>
<album-small>
<h2>What</h2>
<h3>What wat what wat what what wat</h3>
</album-small>
</div>
<polymer-element name='album-small' noscript>
<template>
<style>
.album-header {
/* Note: relative positioning seems necessary
for paper-ripple. */
position: relative;
padding: 10px;
height: 200px;
z-index: 100;
}
</style>
<div class="album-header" vertical layout>
<paper-ripple class='recenteringTouch' fit></paper-ripple>

<content select="img"></content>
<div class="description">
<content select="h2">hi</content>
<content select="h3">hi</content>
</div>
</div>
</template>
</polymer-element>

</body>
</html>

关于 polymer 在所有 child 身上泛起涟漪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24840780/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com