filter:blur for mozilla firefox <svg> not working

送分小仙女□ 提交于 2019-12-20 06:15:29

问题


I am developing a page that will animate the image, fade in with blur style. It works in google chrome but in mozilla firefox didn't.

I try this approach for the mozilla firefox . http://css-plus.com/2010/05/how-to-add-a-gaussian-blur-effect-to-elements-within-firefox/ but the images were not visible.

this is my code :

js:

<script type="text/javascript">
$(document).ready(function() {
    $("img").css({
        "filter": "blur(4px)", 
        "-webkit-filter": "blur(4px)", 
        "-moz-filter": "blur(4px)",
        "-o-filter": "blur(4px)",
        "-ms-filter": "blur(4px)",
        "filter":"url('#blur1')"
    });
    window.setTimeout(function() {
        $("img").css({
            "filter": "blur(3px)", 
            "-webkit-filter": "blur(3px)", 
            "-moz-filter": "blur(3px)",
            "-o-filter": "blur(3px)",
            "-ms-filter": "blur(3px)",
            "filter":"url('#blur1')"
        });
    }, 3000);
    window.setTimeout(function() {
        $("img").css({
            "filter": "blur(2px)", 
            "-webkit-filter": "blur(2px)", 
            "-moz-filter": "blur(2px)",
            "-o-filter": "blur(2px)",
            "-ms-filter": "blur(2px)",
            "filter":"url('#blur1')"
        });
    }, 3100);
    window.setTimeout(function() {
        $("img").css({
            "filter": "blur(1.5px)", 
            "-webkit-filter": "blur(1.5px)", 
            "-moz-filter": "blur(1.5px)",
            "-o-filter": "blur(1.5px)",
            "-ms-filter": "blur(1.5px)",
            "filter":"url('#blur1')"
        });
    }, 3200);
    window.setTimeout(function() {
        $("img").css({
            "filter": "blur(1px)", 
            "-webkit-filter": "blur(1px)", 
            "-moz-filter": "blur(1px)",
            "-o-filter": "blur(1px)",
            "-ms-filter": "blur(1px)",
            "filter":"url('#blur1')"

        });
    }, 3300);
    window.setTimeout(function() {
        $("img").css({
            "filter": "", 
            "-webkit-filter": "", 
            "-moz-filter": "",
            "-o-filter": "",
            "-ms-filter": "",
            "filter":"url('#blur1')"
        });
    }, 3400);
    $("#promoIMG").fadeIn(5000);
});
</script>

html:

<div id="promoIMG">
    <a href="main.php"><img src="images/akb1.png" alt="" onMouseOver="this.src='images/akb2a.png'" onMouseOut="this.src='images/akb1.png'"/></a><br/>
    <img src="images/akb2.png" alt="AKB" />
</div>
</div>
<svg>
    <filter id="blur1">
        <svg:feGaussianBlur stdDeviation="1"/>
     </filter>
</svg>

where did I do wrong? and how can I make it correct so that the page animation of mozilla firefox will be same in chrome.

thanks in advance


回答1:


I got it, I add this

<svg height="0" xmlns="http://www.w3.org/2000/svg">
<filter id="blur1">
        <svg:feGaussianBlur stdDeviation="1"/>
     </filter>
</svg>



回答2:


Had the same problem; image not showing (similar to the @kidwon's jsbin). solved it by having the svg snippet located in an external file and loading it via

filter: url("/blur.svg#blur");

in the css. QUOTED, did not worked without.



来源:https://stackoverflow.com/questions/14595675/filterblur-for-mozilla-firefox-svg-not-working

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