Permalink
Browse files

Fixed animation queuing, add click to close and hiding of any visible…

… bars before showing a new one
  • Loading branch information...
1 parent a8dd777 commit 043a13493679b0c0b1734d49941d5aeeb5cf89c4 Sam Bowler committed Dec 4, 2010
Showing with 15 additions and 3 deletions.
  1. +15 −3 jquery.notifyBar.js
View
@@ -85,13 +85,25 @@ jQuery.notifyBar = function(settings) {
});
}
- bar.slideDown(asTime);
+ // Check if we've got any visible bars and if we have, slide them up before showing the new one
+ if($('.jquery-notify-bar:visible').length > 0) {
+ $('.jquery-notify-bar:visible').stop().slideUp(asTime, function() {
+ bar.stop().slideDown(asTime);
+ });
+ } else {
+ bar.slideDown(asTime);
+ }
+
+ // Allow the user to click on the bar to close it
+ bar.click(function() {
+ $(this).slideUp(asTime);
+ })
// If taken from DOM dot not remove just hide
if( bar.attr("id") == "__notifyBar") {
- setTimeout("jQuery('#" + id + "').slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime);
+ setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime);
} else {
- setTimeout("jQuery('#" + id + "').slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime);
+ setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime);
}
})(jQuery) };

0 comments on commit 043a134

Please sign in to comment.