d
Topic
IAMTEEJAY Member
Posts:
15
Last edited 6 days ago

J-Query Not Working

Everything I have read about how to add external JS (JQuery) doesn't seem to work. Any recommendation for adding the JQuery accordion (not product related) to the site?  Tried adding it straight onto the theme.liquid layout file, tried adding them as a new JS Asset file. Each time it gets added but it won't function without the JQuery in front of it. So, I tried adding the JQuery but Shopify prohibits it and renders is dysfunctional.

This is for jquery-accordion-menu.js and the little on-page js code that looks like this 

<script type="text/javascript">
            jQuery(document).ready(function() {
                jQuery("#jquery-accordion-menu").jqueryAccordionMenu();
                jQuery(".colors a").click(function() {
                    if ($(this).attr("class") != "default") {
                        $("#jquery-accordion-menu").removeClass();
                        $("#jquery-accordion-menu").addClass("jquery-accordion-menu").addClass($(this).attr("class"));
                    } else {
                        $("#jquery-accordion-menu").removeClass();
                        $("#jquery-accordion-menu").addClass("jquery-accordion-menu");
                    }
                });
            });
        </script>

Any recommendations would be very helpful.

Thanks, Teejay