要解决filter无法修改的问题,可以使用以下步骤:

  1. 将content的filter属性修改为变量,例如var filterValue = 'blur(3px)';

  2. 在range.onchange事件处理程序中,将content.style.filter的值设置为变量filterValue,例如content.style.filter = filterValue;

  3. 在inp.onchange事件处理程序中,将filterValue的值设置为适当的滤镜效果,例如filterValue = 'blur(' + range.value/100 + 'px)';

这样就可以根据滑块的值动态修改背景的滤镜效果。


原文地址: https://www.cveoy.top/t/topic/iAsh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录