簡體   English   中英

Chrome / Firefox 中的 head.js 和 jQuery 問題 5

[英]head.js and jQuery issues in Chrome / Firefox 5

所以頁面是這樣渲染的:

<!DOCTYPE html>
<html>

<head>
  <script>

   head.js("js/jquery.js",
           "js/jquery.autocomplete.js");

  </script>
</head>

<body>

  ...
  stuff here
  ...

  <script>

    jQuery(document).ready(function($){  // fail...

      $('body').removeClass('no-jquery');
      // ...

    });
  </script>
</body>
</html>

腳本似乎在 Opera 中加載,但在 Firefox 5 和 Chrome 中(不知道版本,因為它每天都在變化)我收到一個錯誤:

jQuery is not defined
[Break On This Error] jQuery(document).ready(function($){ 

所以我猜 jquery 在這些瀏覽器中不是真正由 head.js 加載的嗎? 還是我做錯了什么?


jsfiddle: http://jsfiddle.net/LDUUd/

嘗試切換到head.ready()而不是jQuery.ready()

這是它工作的一個例子- 這是你所擁有的嗎?

你打電話head.js()沒有

<!-- assuming it's in the same directory as the page -->
<script src="head.min.js"></script>

第一的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM