Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Including jQuery without effecting other scripts
#1
I am using a javascript that requires jquery in the header template like?

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="images/clearclouds/scripts/nav.js"></script>

But when I have
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

Included in my header the collapse & expand, and multiquote & delete postbit functions won't work.

How can I include jQuery without effecting any other scripts on MyBB?
Reply
#2
I thought you knew how to do it :O

There are several things you could do. The easiest one is to replace the "$" in your jQuery code for something like "jQ" (that's IMO). As the "$" in jQuery means jQuery, but is different for prototype.

At the top of your jQuery code (before the first of your fuctions) add something like jQ = $; And done, just use jQ intead of $
Reply
#3
All you need to do is call 'jQuery.noConflict();' and then just put 'jQuery' where you would put the '$'. And as combus said it could also work with 'jQ'. To use that it would be 'jQ.noConflict();'
Reply
#4
I tried that noConflict code but than I only get to see the background of the site and the rests disappears...

Hold on...
Grm sorry for being a Dum Dum I forgot to define "jQ" in the "jQuery("div").hide();" part xD.

But this works Toungue
   <script>
     jQuery.noConflict();
     
     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery("jQ").hide();
     });
     
     // Use Prototype with $(...), etc.
     $('jQ').hide();
   </script>
Reply
#5
    // Use Prototype with $(...), etc.
     $('jQ').hide();

^ That makes no sense >.> Just get rid of it. You're saying you want to hide <jQ></jQ> elements on the HTML
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)