Browse Source

修改通知消息方法

笔下光年 6 years ago
parent
commit
f9ab8d5704
2 changed files with 11 additions and 11 deletions
  1. 7 7
      js/lightyear.js
  2. 4 4
      lyear_js_notify.html

+ 7 - 7
js/lightyear.js

@@ -24,15 +24,15 @@ var lightyear = function(){
      * 页面小提示
      * @param $msg 提示信息
      * @param $type 提示类型:'info', 'success', 'warning', 'danger'
-     * @param $time 毫秒数,例如:1000
+     * @param $delay 毫秒数,例如:1000
      * @param $icon 图标,例如:'fa fa-user' 或 'glyphicon glyphicon-warning-sign'
      * @param $from 'top' 或 'bottom'
      * @param $align 'left', 'right', 'center'
      * @author CaiWeiMing <314013107@qq.com>
      */
-    var tips = function ($msg, $type, $time, $icon, $from, $align) {
+    var tips = function ($msg, $type, $delay, $icon, $from, $align) {
         $type  = $type || 'info';
-        $time  = $time || 1000;
+        $delay = $delay || 1000;
         $from  = $from || 'top';
         $align = $align || 'center';
         $enter = $type == 'danger' ? 'animated shake' : 'animated fadeInUp';
@@ -54,8 +54,8 @@ var lightyear = function(){
             offset: 20,
             spacing: 10,
             z_index: 10800,
-            delay: 3000,
-            timer: $time,
+            delay: $delay,
+            //timer: 1000,
             animate: {
                 enter: $enter,
                 exit: 'animated fadeOutDown'
@@ -65,8 +65,8 @@ var lightyear = function(){
 	
 	return {
         // 页面小提示
-        notify  : function ($msg, $type, $time, $icon, $from, $align) {
-            tips($msg, $type, $time, $icon, $from, $align);
+        notify  : function ($msg, $type, $delay, $icon, $from, $align) {
+            tips($msg, $type, $delay, $icon, $from, $align);
         },
         // 页面加载动画
 		loading : function ($mode) {

+ 4 - 4
lyear_js_notify.html

@@ -291,8 +291,8 @@ lightyear.loading('hide');  // 隐藏</code></pre>
                     <td>提示类型:'info', 'success', 'warning', 'danger'</td>
                   </tr>
                   <tr>
-                    <td>$time</td>
-                    <td>毫秒数</td>
+                    <td>$delay</td>
+                    <td>定义消息提示消失的时间,毫秒数</td>
                   </tr>
                   <tr>
                     <td>$icon</td>
@@ -336,7 +336,7 @@ $('#example-success-notify').on('click', function(){
     // 假设ajax提交操作
     setTimeout(function() {
         lightyear.loading('hide');
-        lightyear.notify('修改成功,页面即将自动跳转~', 'success', 5000);
+        lightyear.notify('修改成功,页面即将自动跳转~', 'success', 3000);
     }, 1e3)
 });
 $('#example-error-notify').on('click', function(){
@@ -344,7 +344,7 @@ $('#example-error-notify').on('click', function(){
     // 假设ajax提交操作
     setTimeout(function() {
         lightyear.loading('hide');
-        lightyear.notify('服务器错误,请稍后再试~', 'danger');
+        lightyear.notify('服务器错误,请稍后再试~', 'danger', 100);
     }, 1e3)
 });
 </script>