1. tehshin
  2. jquery-notifyme

Commits

tehshin  committed b2c510a

removed default title for message. changed the styling of message.

  • Participants
  • Parent commits 1a6581c
  • Branches default

Comments (0)

Files changed (3)

File sample/scripts/sample.js

View file
     });
     $('#showwarning').click(function () {
         $.notifyme('warning', 
-            'This is a warning message. ' + getCurrentTime());
+            'This is a warning message. ' +getCurrentTime());
         return false;
     });
     $('#showerror').click(function () {

File src/jquery.notifyme.css

View file
     width: 16px;
     height: 16px;
     line-height: 16px;
-    padding-left: 1px;
+    padding-left: 0px;
     text-align: center;
     left: 5px;
     top: 2px;
     overflow: auto;
 }
 .notifyme .content .message {
+    position: relative;
     margin: 3px;
     border: 2px solid #000;
     border-radius: 3px;
     -moz-border-radius: 3px;
     -webkit-border-radius: 3px;
 }
+.message .closer {
+    position: absolute;
+    top: 1px;
+    right: 3px;
+    color: #000;
+    text-decoration: none;
+    font-weight: bold;
+}
 .message .head {
+    font-weight: bold;
     padding: 3px;
     border-top-left-radius: 3px;
     border-top-right-radius: 3px;
     -moz-border-radius-topright: 3px;
 }
 .message .body {
-    padding: 3px;
+    padding: 5px;
     font-size: 0.9em;
-    background: #282828;
 }
-.info .head {
+.info {
     background: #eee;
     color: #232323;
-    border-bottom: 1px solid #000;
 }
-.warning .head {
+.warning {
     background: #FFE45C;
     color: #232323;
-    border-bottom: 1px solid #000;
 }
-.error .head {
+.error {
     background: #F62817;
-    border-bottom: 1px solid #000;
 }

File src/jquery.notifyme.js

View file
         var $message = $('<div/>', { style: 'display:none;' })
             .addClass('message').addClass(config[className]);
         
-        var title = type;
+        var title = "";
         var body = "";
         if(typeof message === 'object') {
             title = message.title;
             body = message;
         }
         
-        var $head = $('<div/>').addClass('head').text(title)
-            .click(function () {
-                $(this).parent().fadeToggle('fast', function () {
-                    $(this).remove(); 
-                    if(!hasMessages() && !config.preserve) {
-                        closeNotificationWindow();
-                    }
-                });
+        if(title !== "") {
+            var $head = $('<div/>').addClass('head').text(title);
+            $message.append($head);
+        }
+        
+        var $body = $('<div/>').addClass('body').text(body);
+            
+        var $closer = $('<a/>', { 
+            'href': '#', 
+            'title': 'close message',
+            'class': 'closer' 
+        }).text('x').click(function () {
+            $(this).parent().fadeToggle('fast', function () {
+                $(this).remove(); 
+                if(!hasMessages() && !config.preserve) {
+                    closeNotificationWindow();
+                }
             });
+        });
         
-        var $body = $('<div/>').addClass('body').text(body);    
-        return $message.append($head).append($body);
+        return $message.append($body).append($closer);
     }
     
     function addMessage(type, message) {