internet explorer 10 - how to apply grayscale filter?

前端 未结 3 1311
盖世英雄少女心
盖世英雄少女心 2020-11-27 03:35

This CSS code works pretty nice for Internet Explorer until 9.

img.gray {
    filter: url(\"data:image/svg+xml;utf8,

        
3条回答
  •  广开言路
    2020-11-27 04:08

    Use this jQuery plugin https://gianlucaguarini.github.io/jQuery.BlackAndWhite/

    That seems to be the only one cross-browser solution. Plus it has a nice fade in and fade out effect.

    $('.bwWrapper').BlackAndWhite({
        hoverEffect : true, // default true
        // set the path to BnWWorker.js for a superfast implementation
        webworkerPath : false,
        // to invert the hover effect
        invertHoverEffect: false,
        // this option works only on the modern browsers ( on IE lower than 9 it remains always 1)
        intensity:1,
        speed: { //this property could also be just speed: value for both fadeIn and fadeOut
            fadeIn: 200, // 200ms for fadeIn animations
            fadeOut: 800 // 800ms for fadeOut animations
        },
        onImageReady:function(img) {
            // this callback gets executed anytime an image is converted
        }
    });
    

提交回复
热议问题