1
0
Moritz Schmidt 9 yıl önce
ebeveyn
işleme
553bd2b84b
2 değiştirilmiş dosya ile 16 ekleme ve 9 silme
  1. 8 8
      dist/scripts.js
  2. 8 1
      functions.php

+ 8 - 8
dist/scripts.js

@@ -7,6 +7,14 @@ jQuery( document ).ready(function($) {
     $('.navbar-toggler').click();
   });
 
+  $(document).on('click', 'a.scroll-link[href^="#"]', function(e){
+    e.preventDefault();
+
+    $('html, body').animate({
+      scrollTop: $( $.attr(this, 'href') ).offset().top
+    }, 500);
+  });
+
   /** TdA Carousel **/
 
   $('.owl-carousel').slick({
@@ -21,12 +29,4 @@ jQuery( document ).ready(function($) {
       prevArrow: '<span class="icon-prev" aria-hidden="true"><i class="fa fa-chevron-left" aria-hidden="true"></i></span>',
   });
 
-  $(document).on('click', 'a.scroll-link[href^="#"]', function(e){
-    e.preventDefault();
-
-    $('html, body').animate({
-      scrollTop: $( $.attr(this, 'href') ).offset().top
-    }, 500);
-  });
-
 });

+ 8 - 1
functions.php

@@ -759,7 +759,14 @@ add_filter( 'wp_title', 'ams_modify_titles', 10, 2 );
 
 
 function my_async_scripts( $tag, $handle, $src ) {
-  return '<script type="text/javascript" src="' . $src . '" async></script>' . "\n";
+  // if($handle == "scripts") { // load scripts when everything else finished loading
+  //   return '<script type="text/javascript" src="' . $src . '" defer></script>' . "\n";
+  // }
+
+  if($handle != "jquery") { // only load jquery instant
+    return '<script type="text/javascript" src="' . $src . '" async></script>' . "\n";
+  }
+  return $tag;
 }
 add_filter( 'script_loader_tag', 'my_async_scripts', 10, 3 );