Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

$.fn.refreshPng() #1

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions js/jquery.belatedPNG.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,32 @@ Absolutely everything in this script is SILLY. I know this. IE's rendering of
});
}
return this;
},

/**
* Forcely apply changes to VML by firing propertychange event.
* It's mainly for changes applied by updating parent element's class name.
*
* @param Boolean opacity : Update opacity or not
*/
refreshPng: function(opacity) {
if ([,] == 0) { return this; } // Not IE6/7/8
this.each(function(){
var $el, opacities;
$el = $(this);
$el.prop({
'change-background': true,
'style.display': true // For IE7
});
if(opacity){
opacities = [1];
$el.parents('*').each(function(){
opacities.push($(this).css('opacity'));
});
$el.css('opacity', Math.min.apply(null, opacities));
}
});
return this;
}
});
})(jQuery);