Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Forum Module /

Discuss the Forum Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Javascript problem


Go to End


12 Posts   4318 Views

Avatar
animasola

Community Member, 121 Posts

19 June 2009 at 4:24am

Hi,

I'm currently finishing a site for a school organization which I am a part of and I just have some minor problems that I wanna fix. I used mootools (js framework) to animate my main navigation but it seems that it doesn't work once I view the forum and event calendar pages. I tried to trace the problem and I found out that those pages have javascript includes which may conflict with the ones I have written.

Here is the site btw: http://lexlounge.com/

Can anyone help me with this problem?

Avatar
Nivanka

Community Member, 400 Posts

19 June 2009 at 6:27am

sometimes for some pages SS use jQuery and Prototype, both has the $ function, but for jQuery there is a way to avoid the conflicts by calling the jQuery.noConflicts() function.

I am not sure whether mootools has that too. Check it with that, also I tried to help one of my friends with this, but I couldnt find a way to solve it. if anyone can it will be a great help.

Avatar
animasola

Community Member, 121 Posts

19 June 2009 at 1:08pm

Thanks! Just what I needed, I didn't know that these pages used JQuery and Prototype and I'm not familiar with the $ function as well. I'll try to solve it myself in the meantime. But to anyone who is an expert or who is familiar with this problem, please do help. Thanks a lot!

Thanks Nivanka! :)

Avatar
Nivanka

Community Member, 400 Posts

19 June 2009 at 2:41pm

welcome,

I am too eager to find out a way to use mootools with other javascript libraries. I think better if you can post on their forums.

Avatar
animasola

Community Member, 121 Posts

19 June 2009 at 2:51pm

Edited: 19/06/2009 2:56pm

I just followed your advice and used jQuery.noConflict(); as an inline script right after the call to the core main jquery library.

I inserted it within the CalendarUI.class.php on line 23, within the customScript. And with others that also required jquery, I just placed this line of code after each call:

Requirements::customScript("
jQuery.noConflict();
");

I'm not sure if this is safe but it works nonetheless. Thanks again Niv!

Cheers,
Vic

Avatar
Nivanka

Community Member, 400 Posts

19 June 2009 at 2:53pm

it must be safe, so all working fine now?

Avatar
animasola

Community Member, 121 Posts

19 June 2009 at 2:56pm

Yep! Thanks a lot! :)

Avatar
draft

Community Member, 57 Posts

7 July 2009 at 4:28pm

Hi,

I'm having the same problem with mootools.. In my main page, i have an animation using mootools, but when i create a form there (which will create javascript validation), the animation stop working, and it gave me this javascript error : $$.shared is not defined.

Anyone can help me? Please tell me where to put the jquery.noconflicts function?

-Draft

Go to Top