Home > TYPO3 Entwicklung > MooTools – jQuery Konflikt unter TYPO3

MooTools – jQuery Konflikt unter TYPO3

16. März 2010

Ich hatte das Problem dass die Accordion Erweiterung die ich z.Z verwende in MooTools Framework läuft und für einen anderen Effekt wird eine jQuery Lösung verwendet. Auf dem ersten Blick funktionieren die Beiden nicht gut zusammen. D.h. MooTool lief super, jQuery schmiess aber eine Fehlermeldung.

Auf der Seite von jQuery wir das so erklärt und gelöst:

„Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery’s case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict():“

Lösung:

<script type=“text/javascript“ src=“other_lib.js“></script>
<script type=“text/javascript“ src=“jquery.js“></script>
<script type=“text/javascript“>
$.noConflict();
jQuery(document).ready(function($) {
// Code that uses jQuery’s $ can follow here.
});
// Code that uses other library’s $ can follow here.
</script>

Kommentare sind geschlossen