highlight element after update, fix #245

This commit is contained in:
vitalets
2013-06-23 13:56:10 +04:00
parent 30242780ce
commit d5eeb3e1b9
4 changed files with 55 additions and 1 deletions

View File

@@ -16,6 +16,11 @@ Makes editable any HTML element on the page. Applied as jQuery method.
} else {
this.init();
}
//check for transition support
if(this.options.highlight && !$.fn.editableutils.supportsTransitions()) {
this.options.highlight = false;
}
};
Editable.prototype = {
@@ -382,6 +387,21 @@ Makes editable any HTML element on the page. Applied as jQuery method.
}
}
//highlight when saving
if(this.options.highlight) {
var $e = this.$element,
$bgColor = $e.css('background-color');
$e.css('background-color', this.options.highlight);
setTimeout(function(){
$e.css('background-color', $bgColor);
$e.addClass('editable-bg-transition');
setTimeout(function(){
$e.removeClass('editable-bg-transition');
}, 1500);
}, 0);
}
//set new value
this.setValue(params.newValue, false, params.response);
@@ -761,7 +781,16 @@ Makes editable any HTML element on the page. Applied as jQuery method.
});
</script>
**/
selector: null
selector: null,
/**
Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers.
@property selector
@type string|boolean
@since 1.4.5
@default #FFFF80
**/
highlight: '#FFFF80'
};
}(window.jQuery));