/** * @author mvideaud */ jQuery(function($) { $.fn.notification = function(options) { var options = $.extend({ fixe : false, type : "info", contenu : "Ma super notification.", delai : 5000, }, options); var iconeBootstrap = null; var alertBootstrap = null; switch(options.type) { case 'success': iconeBootstrap = 'check'; alertBootstrap = 'success'; break; case 'confirm': iconeBootstrap = 'check'; alertBootstrap = 'confirm'; break; case 'error': iconeBootstrap = 'times'; alertBootstrap = 'danger'; break; case 'warning' : iconeBootstrap = 'warning'; alertBootstrap = 'warning'; break; default: iconeBootstrap = 'info'; alertBootstrap = 'info'; break; } var notification = $('
'+ (options.fixe == true ? '' : '
')+ '
'+ '

'+ '
'+options.contenu+'
'+ '
'+ '
'); var timerSeconds = 0; var timerFinish = 0; var timer = null; return this.each(function() { var self = $(this); //recherche si notifications existe var notifications = $('.notifications', self); // si absent -> injection if(notifications.length == 0){ notifications = $('
'); self.append(notifications); } // insertion de la notification notifications.append(notification); // ajout modal-backdrop if(options.fixe == true) { $('header').prepend('