Browse Source

修改定时器位置,解决菜单按钮延时闪烁bug

ming 1 năm trước cách đây
mục cha
commit
f574a27c7f
1 tập tin đã thay đổi với 13 bổ sung6 xóa
  1. 13 6
      assets/js/jquery.meanmenu.min.js

+ 13 - 6
assets/js/jquery.meanmenu.min.js

@@ -2,7 +2,7 @@
     'use strict';
    
         $.fn.meanmenu = function(e) {
-            setTimeout(()=>{
+            
             var n = {
                 meanMenuTarget: jQuery(this),
                 meanMenuContainer: 'body',
@@ -96,10 +96,13 @@
                                 jQuery('.mean-container').prepend(
                                     '<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="' +
                                     e +
-                                    '">Show Navigation</a><nav class="mean-nav"></nav></div>'
+                                    '">Show Navigation</a><nav class="mean-nav">x`</nav></div>'
                                 );
-                            var r = jQuery(n).html();
-                            jQuery('.mean-nav').html(r),
+                                jQuery(v).html(s),
+
+                                setTimeout(function(){
+                                    var r = jQuery(n).html();
+                                    jQuery('.mean-nav').html(r),
                                 Q &&
                                 jQuery(
                                     'nav.mean-nav ul, nav.mean-nav ul *'
@@ -116,7 +119,7 @@
                                 jQuery('.mean-push').css('margin-top', c),
                                 jQuery(n).hide(),
                                 jQuery('.meanmenu-reveal').show(),
-                                jQuery(v).html(s),
+                                
                                 (M = jQuery(v)),
                                 jQuery('.mean-nav ul').hide(),
                                 h ?
@@ -196,6 +199,11 @@
                                             .html(s);
                                     }
                                 );
+
+
+                                },300)
+                            
+                            
                         } else W();
     
                        
@@ -221,7 +229,6 @@
                     }),
                     b();
             });
-        },300)
         };