-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.sf-flash.js
More file actions
34 lines (26 loc) · 920 Bytes
/
jquery.sf-flash.js
File metadata and controls
34 lines (26 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function ($) {
var defaultOptions = {
delay: 50,
duration: 5000
};
$.fn.sfFlash = function(options) {
var settings = $.extend(defaultOptions, options);
var flashMessage = this;
$(document).on("DOMSubtreeModified", function() {
// We refresh the selector to include new elements. Unfortunately, there is no better way to do this today.
flashMessage = $(flashMessage.selector);
main();
});
var main = function() {
if (flashMessage) {
window.setTimeout(function(){
flashMessage.show().addClass('fadeInUp animated');
}, settings.delay);
window.setTimeout(function(){
flashMessage.addClass('fadeOutDown animated');
}, settings.duration);
}
}
main();
}
} (jQuery));