Bonsoir j'écris en ce moment un nouveau petit plugin histoire de continuer à me faire la main avec les extensions.
Cependant, je rencontre un probléme avec une mauvaise initialisation quelque part qui me retourne systématiquement un false.
J'ai surement louper un truc lol :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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);
J'ai initialiser dans le show uniquement les 2 paramètres de départ pour justement ne pas devoir chercher une aiguille dans un petite botte de foin
Si j'enléve l if j'ai une belle erreur dans firebug:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
$(this).startWidth is not a function
http://localhost/tuto_jquery/js/jquery.msgcolor.js
Line 29