Prevent auto hide on close btn visible #4

Closed
wants to merge 2 commits into
from
View
@@ -40,8 +40,11 @@ jQuery.notifyBar = function(settings) {
//Set up own class
notifyBarNS.cls = settings.cls || "";
- //close button
- notifyBarNS.close = settings.close || false;
+ //close button if injected as true the delay is not needed until the hideDelayedOnCloseBtnVisible is set to true
+ notifyBarNS.close = settings.close || false;
+
+ //hide the bar even if close btn option is set to true
+ notifyBarNS.respectHideDelay = settings.respectHideDelay == undefined ? true : settings.respectHideDelay;
if( notifyBarNS.jqObject) {
bar = notifyBarNS.jqObject;
@@ -99,11 +102,14 @@ jQuery.notifyBar = function(settings) {
$(this).slideUp(asTime);
})
- // If taken from DOM dot not remove just hide
- if( bar.attr("id") == "__notifyBar") {
- setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime);
- } else {
- setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime);
- }
-
+ // If taken from DOM dot not remove just hide
+ if (!notifyBarNS.close || (notifyBarNS.close && notifyBarNS.respectHideDelay)) {
+ // If taken from DOM dot not remove just hide
+ if( bar.attr("id") == "__notifyBar") {
+ setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime);
+ } else {
+ setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime);
+ }
+ }
+
})(jQuery) };