[ Index ] |
PHP Cross Reference of YOURLS |
[Summary view] [Print] [Text view]
1 /* 2 * Notify Bar - jQuery plugin 3 * 4 * Copyright (c) 2009-2010 Dmitri Smirnov 5 * 6 * Licensed under the MIT license: 7 * http://www.opensource.org/licenses/mit-license.php 8 * 9 * Version: 1.2.2 10 * 11 * Project home: 12 * http://www.dmitri.me/blog/notify-bar 13 */ 14 15 /** 16 * param Object 17 */ 18 jQuery.notifyBar = function(settings) { 19 20 (function($) { 21 22 var bar = notifyBarNS = {}; 23 notifyBarNS.shown = false; 24 25 if( !settings) { 26 settings = {}; 27 } 28 // HTML inside bar 29 notifyBarNS.html = settings.html || "Your message here"; 30 31 //How long bar will be delayed, doesn't count animation time. 32 notifyBarNS.delay = settings.delay || 2000; 33 34 //How long notifyBarNS bar will be slided up and down 35 notifyBarNS.animationSpeed = settings.animationSpeed || 200; 36 37 //Use own jquery object usually DIV, or use default 38 notifyBarNS.jqObject = settings.jqObject; 39 40 //Set up own class 41 notifyBarNS.cls = settings.cls || ""; 42 43 //close button 44 notifyBarNS.close = settings.close || false; 45 46 if( notifyBarNS.jqObject) { 47 bar = notifyBarNS.jqObject; 48 notifyBarNS.html = bar.html(); 49 } else { 50 bar = jQuery("<div></div>") 51 .addClass("jquery-notify-bar") 52 .addClass(notifyBarNS.cls) 53 .attr("id", "__notifyBar"); 54 } 55 56 bar.html(notifyBarNS.html).hide(); 57 var id = bar.attr("id"); 58 switch (notifyBarNS.animationSpeed) { 59 case "slow": 60 asTime = 600; 61 break; 62 case "normal": 63 asTime = 400; 64 break; 65 case "fast": 66 asTime = 200; 67 break; 68 default: 69 asTime = notifyBarNS.animationSpeed; 70 } 71 if( bar != 'object'); { 72 jQuery("body").prepend(bar); 73 } 74 75 // Style close button in CSS file 76 if( notifyBarNS.close) { 77 bar.append(jQuery("<a href='#' class='notify-bar-close'>Close [X]</a>")); 78 jQuery(".notify-bar-close").click(function() { 79 if( bar.attr("id") == "__notifyBar") { 80 jQuery("#" + id).slideUp(asTime, function() { jQuery("#" + id).remove() }); 81 } else { 82 jQuery("#" + id).slideUp(asTime); 83 } 84 return false; 85 }); 86 } 87 88 bar.slideDown(asTime); 89 90 // If taken from DOM dot not remove just hide 91 if( bar.attr("id") == "__notifyBar") { 92 setTimeout("jQuery('#" + id + "').slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime); 93 } else { 94 setTimeout("jQuery('#" + id + "').slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime); 95 } 96 97 })(jQuery) };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Mar 28 05:10:25 2025 | Cross-referenced by PHPXref 0.7.1 |