Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-29 01:35:08

jshan
Member
Registered: 2008-01-09
Posts: 67

JQuery incompatible with moo.fx??

Hi,

I’m designing the homepage that utilizes both moo.fx and JQuery. They don’t seem to co-exist well on the same page from the testing done so far. When I just have either moo.fx part or JQuery part on the page, it works fine. But when I have them both on the page, only the part comes the second works.

The moo.fx part looks like the following in the <head>:

<script type="text/javascript" src="<txp:link_to_home />js/prototype.lite.js"></script>
<script type="text/javascript" src="<txp:link_to_home />js/moo.fx.js"></script>
<script type="text/javascript">
    var opened=false;
    window.onload = function() {
        resizeHeight = new fx.Height('slide',{duration:1800});
    };
//...etc

The JQuery part looks like the following in the <head>:

<script type="text/javascript" src="<txp:link_to_home />js/jquery.js"></script>
<script type="text/javascript">
	$ (function(){
//…custom code ommited }); </script>

What is strange to me is that, for example, if I put the JQuery part right after moo.fx, like the above, then I’ll get the error:

Object resizeHeight undefined.

I’m completely in a cloud here… help/hint/suggestion would be much appreciated!

Jay

Offline

#2 2009-01-29 04:30:13

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: JQuery incompatible with moo.fx??

Yes. Activate compatibility mode in jQuery and then never use the $ shortcut when writing jquery.

jQuery.noConflict();

Last edited by Walker (2009-01-29 04:30:44)

Offline

#3 2009-01-30 18:21:12

jshan
Member
Registered: 2008-01-09
Posts: 67

Re: JQuery incompatible with moo.fx??

Walker, great tip!

In the mean time, I found the following from one jQuery blog

Why can’t I use Prototype, JQuery, Scriptaculous, and mootools in one page?
Short and sweet answer is that you just can’t. The more complicated answer, is that some of those frameworks use similar functions (like $) and they add Events which conflict with mootools. Depending on the order, and the framework that you add you will receive different results. Lastly, mootools is not trying to be conflict free. Therefore, do not expect this to be a bug or unwanted behavior—mootools will not try to become conflict free. Expect, to make a choice between mootools and the other frameworks.

Just thought it might be helpful to post it here :)

Offline

#4 2009-01-30 19:11:37

jshan
Member
Registered: 2008-01-09
Posts: 67

Re: JQuery incompatible with moo.fx??

conflict resolved. Many thanks Walker!

Offline

Board footer

Powered by FluxBB