1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| (function($){
$.fn.msgColor = function(params){
var settings = $.extend({
sWidth : 0,
eWidth : '+=60%',
sHeight : 0,
eHeight : '+=25px'
},params);
var opts = $.extend(settings, params);
/*if no start width and height return false*/
if(!opts.sWidth && !opts.sHeight) return false;
var StartW = opts.sWidth;
var StartH = opts.sHeight;
var EndW = opts.eWidth;
var EndH = opts.eHeight;
function startWidth(startW){
$(this).width(startW);
}
function startHeight(startH){
$(this).height(startH);
}
function endWidth(EndW){
$(this).width(endW);
}
function endHeight(EndH){
$(this).height(endH);
}
$(this).show('slow',function(){
$(this).startWidth(0).startHeight(0).animate({'width':'+=60%'}, 2000)
.animate({ backgroundColor: "#ff7979", color:'#FFFFFF', opacity: 0.8 }, {queue: false, duration: 2000})
.animate({ 'height':'+=25px' }, 2000)
.css({fontWeight:'bold',padding:'5px'});
setTimeout(function(){
$(this).stop();
}, 2000);
});
}
})(jQuery); |
Partager