MyBB Community Forums
Jquery conflict - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Themes (https://community.mybb.com/forum-103.html)
+---- Forum: Theme Support (https://community.mybb.com/forum-10.html)
+---- Thread: Jquery conflict (/thread-79259.html)



Jquery conflict - Trinit - 2010-09-29

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!



RE: Jquery conflict - Tekkie Da - 2010-09-29

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>



RE: Jquery conflict - Trinit - 2010-09-29

Oh thank you very much! It works, now i'm releasing the corrected one Wink


RE: Jquery conflict - Tekkie Da - 2010-09-29

no problem! always happy to help Toungue


RE: Jquery conflict - Damion - 2010-09-29

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
});



RE: Jquery conflict - Tekkie Da - 2010-09-29

I didn't know that!
thanks Damion!!


RE: Jquery conflict - Damion - 2010-09-29

(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