Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Stepping through my page, this line of code turns off my SVG Filter:

if (document.getElementById("cPreview") != null) document.getElementById("cPreview").style.filter =  "brightness(" + parseInt(percentB) + "%)" + " contrast(" + parseInt(percentC) + "%)" +  " saturate(" + parseInt(percentS) + "%)";  

If I add SVG code to that, my CSS Filters are turned off:

if (document.getElementById("cPreview") != null) document.getElementById("cPreview").style.filter = svgCOLOR + "brightness(" + parseInt(percentB) + "%)" + " contrast(" + parseInt(percentC) + "%)" +  " saturate(" + parseInt(percentS) + "%)";  

How do I code that so the SVG Filter and the CSS Filters play nicely together?

Thank you


Someone asked for an example. Here is the original image:

enter image description here

Here is the image with the CSS Filters applied:

enter image description here

Here is the image with the SVG Filter applied:

enter image description here

The image with all filters applied. I had to make this in a photo editor because that one line of code isn't working. It all comes down to that one line of code posted above. I can make CSS work, or make SVG work, but I cannot make both work together. Thank you

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.6k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...