Jump to:

1016 Posts in 567 Topics by 309 members

Forum Module

SilverStripe Forums » Forum Module » Javascript problem

Discuss the Forum Module.

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

Page: 1 2
Go to End
Author Topic: 2100 Views
  • animasola
    Avatar
    Community Member
    121 Posts

    Javascript problem Link to this post

    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?

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Javascript problem Link to this post

    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.

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: Javascript problem Link to this post

    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!

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Javascript problem Link to this post

    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.

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: Javascript problem Link to this post

    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

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Javascript problem Link to this post

    it must be safe, so all working fine now?

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: Javascript problem Link to this post

    Yep! Thanks a lot!

  • draft
    Avatar
    Community Member
    57 Posts

    Re: Javascript problem Link to this post

    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

    2100 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.