[jQuery] problem with my plugin
Hello, I have a problem with my plugin.
I have two error messages:
invalid object initializer
[Break on this error] $(this).startWidth.animate({endwidth},2000)
jquery.m...gcolor.js (ligne 15)
$("#msg").MsgColor is not a function
[Break on this error] endHeight: '+=30%'
my code :
(function($){
var settings;
$.fn.MsgColor= function(callerSettings){
settings = $.extends({
startWidth:0,
endwidth:null,
startHeight:0,
endHeight:null
},callerSettings||{});
startWidth = $(this).width(startWidth);
endWidth = $(this).width(endWidth);
startHeight = $(this).height(startHeight);
endHeight = $(this).height(endHeight);
settings.anim = $(this).show('slow',function(){
$(this).startWidth.animate({endwidth},2000)
.animate({backgroundColor: '#Fbc808', color:'#A71602',opacity:0.8},
{queue:false, duration: 2000});
setTimeout(function(){$(this).stop();},1000);
},function(){
$(this).animate({backgroundColor: '#FFFFFF', color: '#444444'},
2000)
});
}
})(jQuery);
<script type="text/javascript">
$(document).ready(function() {
$('#msg').MsgColor({
startWidth: 0,
endwidth: '+=30%',
startHeight: 0,
endHeight: '+=30%'
});
});
</script>
I do not know what to do is my first plugin :D