MyBB Community Forums

Full Version: Jquery conflict
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there, I released a theme but:
(2010-09-29, 09:27 AM)Anurag Wrote: [ -> ]It looks really good, but I think your jquery for the welcome block is conflicting with mybb as it uses prototype. collapse buttons are no working, editor buttons aren't showing in newthread, new reply.

And he's right. I tried a few changes, but they didn't work! In your opinion how could i fix them? In header_welcomeblock_guest there's this code:


<script src="images/mynic/javascripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
        $(document).ready(function() {

            $(".signin").click(function(e) {
                e.preventDefault();
                $("fieldset#signin_menu").toggle();
                $(".signin").toggleClass("menu-open");
            });

            $("fieldset#signin_menu").mouseup(function() {
                return false
            });
            $(document).mouseup(function(e) {
                if($(e.target).parent("a.signin").length==0) {
                    $(".signin").removeClass("menu-open");
                    $("fieldset#signin_menu").hide();
                }
            });            

        });
</script>

I need it to make this work:
[Image: ri6v7c.jpg]

Thanks in advance!
try adding this
<script type="text/javascript" language="javascript">jQuery.noConflict();</script>
after
<script src="images/mynic/javascripts/jquery.js" type="text/javascript"></script>

and change replace "$" sign to "jQuery" in

<script type="text/javascript">
        $(document).ready(function() {

            $(".signin").click(function(e) {
                e.preventDefault();
                $("fieldset#signin_menu").toggle();
                $(".signin").toggleClass("menu-open");
            });

            $("fieldset#signin_menu").mouseup(function() {
                return false
            });
            $(document).mouseup(function(e) {
                if($(e.target).parent("a.signin").length==0) {
                    $(".signin").removeClass("menu-open");
                    $("fieldset#signin_menu").hide();
                }
            });            

        });
</script>
Oh thank you very much! It works, now i'm releasing the corrected one Wink
no problem! always happy to help Toungue
This will shorten the code a little and you don't have to replace all the "$" with Jquery.

jQuery.noConflict();
jQuery(function($) {
\\ jQuery Goes here :P
});
I didn't know that!
thanks Damion!!
(2010-09-29, 08:21 PM)Anurag Wrote: [ -> ]I didn't know that!
thanks Damion!!

Smile It also removes the need for "$(document).ready(function() {" So helps in more than one way Smile