【发布时间】:2018-09-24 03:51:15
【问题描述】:
我通过应用 svg feColorMatrix 来使用 css 过滤器属性。它在 Firefox 和 Chrome 上运行良好。但它不适用于野生动物园。我一直在使用值、缩进、供应商前缀,但未能在 safari 中成功应用我的过滤器。
谁能帮我确定为什么我的过滤器在 Safari 中不起作用?
您可以在此处查看演示 https://codepen.io/Fallenstedt/pen/OvYGjV
我的 svg 过滤器和视频元素:
<svg class="defs-only">
<filter
id="blue-tint"
color-interpolation-filters="sRGB"
x="0"
y="0"
height="100%"
width="100%">
<feColorMatrix
type="matrix"
values="0 0 0 0 0
0.75 0 0 0 0
1.265 0 0 0 0
0 0 0 1 0
"/>
</filter>
</svg>
<div class="background-vid">
<video id="video"
class="lazy"
autoplay
loop
muted>
<source src="https://storage.googleapis.com/coverr-main/mp4/Cloud_Surf.mp4" type="video/mp4">
</video>
</div>
我的scss:
html, body {
margin: 0;
padding: 0;
}
.defs-only {
position: absolute;
height: 0;
width: 0;
overflow: none;
left: -100%;
}
.background-vid {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
position: absolute;
top: 0;
z-index: -1;
-webkit-filter: grayscale(100%) url(#blue-tint);
filter: grayscale(100%) url(#blue-tint);
video {
object-fit: cover;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
}
【问题讨论】:
标签: css svg svg-filters