Reputation: 2699
I am using jQuery Growl plugin to notify messages to my users in my web site, my messages displayTimeout is 3500, my problem is that some of the notifications messages need to fade after displayTimeout but some needs to stay static until i will remove them. my question is how i make my notifications stay and not fade out? thanks
Upvotes: 1
Views: 3119
Reputation: 2088
I resolved it trought using Growl.settings.duration = duration;
My function I created:
function woobe_message(text, type, duration = 0) {
jQuery('.growl').hide();
if (duration > 0) {
Growl.settings.duration = duration;
}
switch (type) {
case 'notice':
jQuery.growl.notice({message: text});
break;
case 'warning':
jQuery.growl.warning({message: text});
break;
case 'clean':
//clean
break;
default:
jQuery.growl({title: '', message: text});
break;
}
}
Upvotes: 0
Reputation: 21
this cycle is responsible for showing and fading.. you may edit the code..
Growl.prototype.cycle = function() {
var $growl;
$growl = this.$growl();
console.log(this.settings.duration);
return enter code here$growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
};
make it like this..
Growl.prototype.cycle = function() {
var $growl;
$growl = this.$growl();
console.log(this.settings.duration);
if(this.settings.duration==0){
return $growl.queue(this.present);
}else{
return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
}
};
so if you initialize like this..
$.growl({
title: "Saving",
style: "primary",
message: 'Please wait...',
duration: 0
});
it wont fade out.. you might want to fade it manually using "dismiss"
Upvotes: 2
Reputation: 33
In jquery.growl.js file just comment this lines of code:
if ($.growl.settings.displayTimeout > 0) {
setTimeout(function(){
jQuery.growl.settings.noticeRemove(notice, function(){
notice.remove();
});
}, jQuery.growl.settings.displayTimeout);
}
Upvotes: 1