Mixmastermichael
Mixmastermichael

Reputation: 153

two uses of jquery conflict with eachother

on this site, I have 2 uses of jquery, one for "anything slider" and another for a toggle for hide show.

http://www.worklightrpo.com/

If I remove the toggle's link to jquery, the slider works, but the toggle doesn't... this is the link for the toggle's jquery.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>

Does anyone know how I can get them BOTH to work and play nicely?

Thanks

The full portion of code is this:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script>    
        $(document).ready(function() {
            $('.nav-toggle').click(function(){
                //get collapse content selector
                var collapse_content_selector =     $(this).attr('href');                   

                //make the collapse content to be shown or hide
                var toggle_switch = $(this);
                $(collapse_content_selector).toggle(function(){
                    if($(this).css('display')=='none'){
                        toggle_switch.html('Learn More');//change the button label to be 'Show'
                    }else{
                        toggle_switch.html('Condense');//change the button label to be 'Hide'
                    }
                });
            });

        }); 
    </script>

Upvotes: 0

Views: 167

Answers (1)

SAFEER N
SAFEER N

Reputation: 1197

Don’t load two different javascript library versions, only one is ever needed.

Upvotes: 1

Related Questions