CSS filter video but not the controls

心已入冬 提交于 2019-12-12 03:15:42

问题


As is displayed here: http://codepen.io/chriscoyier/pen/zbakI you can apply a filter to videos using css filters.

You define the filter and then you refer to it later when applying it to the video element.

var blur_name='the_blur';
master_video.style.webkitFilter='url(#'+blur_name+')';
master_video.style.mozFilter='url(#'+blur_name+')';
master_video.style.filter='url(#'+blur_name+')';

var blur_name='';
master_video.style.webkitFilter='';
master_video.style.mozFilter='';
master_video.style.filter='';

But how can i get the filter to not blur the controls of the video?


回答1:


To accomplish this, you will have to use custom video controls. There are lots of resources out there that explain how to implement them, for example this article.

I've edited a fiddle I found on Google to illustrate this:

http://fiddle.jshell.net/td8Lao79/

I am applying a simple filter: blur(4px); to the video element, but you can define your filters in HTML and refer to them by ID if you prefer.



来源:https://stackoverflow.com/questions/26892190/css-filter-video-but-not-the-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!