!DOCTYPE htmlhtml head meta charset=utf-8 name=viewport content=width=device-width initial-scale=1 maximum-scale=1 user-scalable=no titleWebCattitle style body background-ima
要解决filter无法修改的问题,可以使用以下步骤:
-
将content的filter属性修改为变量,例如
var filterValue = 'blur(3px)'; -
在range.onchange事件处理程序中,将content.style.filter的值设置为变量filterValue,例如
content.style.filter = filterValue; -
在inp.onchange事件处理程序中,将filterValue的值设置为适当的滤镜效果,例如
filterValue = 'blur(' + range.value/100 + 'px)';
这样就可以根据滑块的值动态修改背景的滤镜效果。
原文地址: https://www.cveoy.top/t/topic/iAsh 著作权归作者所有。请勿转载和采集!