var div = $(".my_class")
div.click(function() {
div.style("color", "blue", "important")
div.append("<div>Color: " + div.style('color') + "</div>")
div.append("<div>Is_Important: " + div.style().getPropertyPriority('color') + "</div>")
})
$.fn.style = function(styleName, value, priority) {
var node = this.get(0)
if (typeof node == 'undefined') {
return
}
var style = node.style
if (typeof styleName != 'undefined') {
if (typeof value != 'undefined') {
var priority = typeof priority != 'undefined' ? priority : ''
style.setProperty(styleName, value, priority)
}
else {
return style.getPropertyValue(styleName)
}
}
else {
return style
}
}
No comments:
Post a Comment