我試過在網上搜索,但仍然無法理解爲什麼我的jQuery函數不能在Joomla中工作。Joomla 3和自定義jQuery函數 - 未定義函數
所以,我有OrionMenu,我想融入我的Joomla 3
作爲一個獨立的這個菜單的偉大工程,而是試圖將其加載到之後的Joomla - Chrome瀏覽器的控制檯說我每次翻身時菜單:
Uncaught TypeError: undefined is not a function jquery-1.10.1.min.js:4
(anonymous function) jquery-1.10.1.min.js:4
n.event.special.(anonymous function).handle jquery.min.js:3
n.event.dispatch jquery.min.js:3
r.handle jquery.min.js:3
搜索後,我發現的Joomla加載它自己的jQuery在noconflict模式,所以我試圖整合OrionMenu的其他方式,而現在它說:
Uncaught TypeError: undefined is not a function (index):47
(anonymous function) (index):47
c jquery-1.10.1.min.js:4
p.fireWith jquery-1.10.1.min.js:4
x.extend.ready jquery-1.10.1.min.js:4
q
我的索引文件的第47行是:
jQuery(document).ready(function() { jQuery().orion({speed: 500}); });
我原來OrionMenu包括是這樣的:
<link href="templates/<?php echo $this->template; ?>/menu-orion/css/styles.css" rel="stylesheet">
<script type="text/javascript" src="templates/<?php echo $this->template; ?>/menu-orion/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
$j(document).ready(function() { $j().orion({speed: 500});});
</script>
讀我改變了它在網絡上的一些東西后,已經提到的一段代碼,返回一個控制檯錯誤 - 索引線上的未定義函數47
我以某種方式相信Joomla的這段代碼打破了一切。
<script type="text/javascript">
jQuery(window).on('load', function() {
new JCaption('img.caption');
});
</script>
但不管怎麼說,幫助將是驚人的:)如果你知道如何實現或者什麼大概可能是錯jQuery(document).ready(function() { jQuery().orion({speed: 500}); });
將是巨大的。
在此先感謝!
@Patrick埃文斯 - 是的,我加載它們只是標籤 – mrGott 2014-09-23 18:14:37
之前你還在包括一個單獨的jQuery文件意味着額外的一到一個的Joomla包括 – 2014-09-23 18:18:00
@Patrick埃文斯? - – mrGott 2014-09-23 18:20:32