• Hi everyone,

    Having some issues with my implementation of JCarousel. I am not sure exactly what I’m doing wrong as I have followed all of the instructions, but it seems as though the actual plugin is not working.

    Anyway, here’s a link:

    https://ashleymosuro.com/newsite/#

    Here is what I have included in my functions.php:

    /* my theme scripts */
    
    function my_theme_scripts() {
      wp_enqueue_script( 'jquery' );
      wp_enqueue_script( 'theme-script', get_template_directory_uri() . '/scripts/jquery.jcarousel.min.js', 'jquery' );
    }   
    
    add_action('init', 'my_theme_scripts');

    and my header.php:

    <script type="text/javascript">
    /**
     * We use the initCallback callback
     * to assign functionality to the controls
     */
    function mycarousel_initCallback(carousel) {
        jQuery('.jcarousel-control a').bind('click', function() {
            carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
            return false;
        });
    };
    
    // Ride the carousel...
    jQuery(document).ready(function() {
        jQuery("#mycarousel").jcarousel({
            scroll: 1,
            initCallback: mycarousel_initCallback,
            // This tells jCarousel NOT to autobuild prev/next buttons
            buttonNextHTML: null,
            buttonPrevHTML: null
        });
    });
    
    </script>

    and finally, the page.php:

    <section>
    			<div class="jcarousel-control">
                      <a href="#">1</a>
                      <a href="#">2</a>
                      <a href="#">3</a>
                      <a href="#">4</a>
                      <a href="#">5</a>
                      <a href="#">6</a>
                      <a href="#">7</a>
                      <a href="#">8</a>
                      <a href="#">9</a>
                      <a href="#">10</a>
            	</div>
            	<div id="mycarousel" class="jcarousel-skin-tango">
                    <ul>
                      <li><img width="300" height="250" src="https://static.flickr.com/66/199481236_dc98b5abb3_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/75/199481072_b4a0d09597_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/57/199481087_33ae73a8de_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/77/199481108_4359e6b971_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/58/199481143_3c148d9dd3_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/72/199481203_ad4cdcf109_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/58/199481218_264ce20da0_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/69/199481255_fdfe885f87_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/60/199480111_87d4cb3e38_s.jpg" alt="" /></li>
                      <li><img width="75" height="75" src="https://static.flickr.com/70/229228324_08223b70fa_s.jpg" alt="" /></li>
                    </ul>
                </div>
    		</section>

    …and maybe we can work this out. As I’m sure it’s something silly I’m missing here.

    Thanks,

    Ash

  • The topic ‘Problem with implementing JCarousel’ is closed to new replies.