1

I'm trying to load a jQuery plugin, tinyCarousel, for use on the page. The jQuery library is included as follows in the layout.xml file:

<layout>
    ...
    <default>
        <reference name="head">
            <action method="addJs" ifconfig="jquery/general/jqueryEnabled">
                <script>jquery-1.10.1.min.js</script>
            </action>
        </reference>
    </default>
    ...
</layout>

I've checked in the browser and the library is definitely present. Next, tinyCarousel.js is loaded from another layout.xml file:

<layout>
    ...
    <default>
        <reference name="head">
            <action method="addJs">
                <script>jquery.tinyCarousel.min.js</script>
            </action>
        </reference>
    </default>
    ...
</layout>

Again, that script is present on the page and in the correct order (after the jQuery library). On the page, I am trying to call tinyCarousel as follows:

<script type="text/javascript">
//<![CDATA[
    if (jQuery === 'undefined') {
        jQuery.noConflict();
    }

    var container = <?php echo "'#" . $containerClass . "'"; ?>;
    jQuery(document).ready(function(){
        jQuery(container).tinycarousel({ interval: true, duration: 300, display: 1 });
    });
//]]>
</script>

The error returned is:

Uncaught TypeError: Object [object Object] has no method 'tinycarousel'

Thanks for taking a look.

1 Answer 1

2

Solved!

This is embarrassing - the theme for magento already included jQuery. I found it riiiight at the top of the <head>. Thanks anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.