in programming

Maphilight for jQuery 1.9.0

jQuery 1.9 was released recently, and removed some things that have long been labeled as deprecated. This broke maphilight slightly, since it was still doing a few checks on $.browser.

I’ve just fixed that. As always, the latest version is available on github.

Write a Comment

Comment

  1. Hi.

    I found a bug:

    The original image size is w:1000 and h:626.

    The html code:
    //Resize

    If the the original image width and height is 550 and 344, than works fine.
    But if they are different does not change the size of the image.

    If i supplements the javascript code:
    wrap = $(‘

    ‘).css({
    display:’block’,
    background:’url(“‘+this.src+'”)’,
    ‘background-size’:this.width+”px “+this.height+”px”, //< --NEW CODE
    position:’relative’,
    padding:0,
    width:this.width,
    height:this.height
    });

    Then works fine in FF, but IE 8 dosent works. Dont resized the image.

    Do you have any idea?

  2. I solved the problem:

    if (has_canvas) { //FF and others
    wrap = $(‘

    ‘).css({
    display:’block’,
    background:’url(“‘+this.src+'”)’,
    ‘background-size’:this.width+”px “+this.height+”px”,
    position:’relative’,
    padding:0,
    width:this.width,
    height:this.height
    });
    } else {//IE
    wrap = $(‘

    ‘).css({
    display:’block’,
    “filter”: “progid:DXImageTransform.Microsoft.AlphaImageLoader(src='”+this.src+”‘, sizingMethod=’scale’)”,
    “-ms-filter” : “progid:DXImageTransform.Microsoft.AlphaImageLoader(src='”+this.src+”‘, sizingMethod=’scale’)”,
    position:’relative’,
    padding:0,
    width:this.width,
    height:this.height
    });
    }

  3. Added a few features to it on Github that I needed, one of which is a bugfix for a dealbreaker if you use Maphilight with resized images on your website.