3

I'm using:

  • wordpress site
  • owl carousel plugin

Here is the JQuery code I'm using:

$(document).ready(function() {

    $("#owl-images").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 

  });

  $(document).ready(function() {

    $("#owl-videos").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 

  });

I've read that wordpress conflits with jquery in this question but I even changed to:

jQuery(document).ready(function() {

    jQuery("#owl-images").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 

  });

  jQuery(document).ready(function() {

    jQuery("#owl-videos").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 

  });

But still not working, still getting

Uncaught TypeError: undefined is not a function

Community
  • 1
  • 1
azhpo
  • 764
  • 3
  • 7
  • 18

3 Answers3

6

Which means your plugin is not included

include the below things in the same priority order

  1. jQuery
  2. owlCarousel

Also make sure that the script links are not giving 404

Cerlin
  • 6,622
  • 1
  • 20
  • 28
6

jQuery(document).ready(function($) {
    $("#owl-images").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 
  });

jQuery(document).ready(function($) {
    $("#owl-videos").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 
  });
Hardik Godhani
  • 461
  • 3
  • 16
3

My answer comes a little late, but I hope it helps others.

  1. see the js changes below

jQuery(document).ready(function($) {
    $("#owl-images").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 
  });

jQuery(document).ready(function($) {
    $("#owl-videos").owlCarousel({
      items : 3,
      itemsDesktop : [1199,3],
      itemsDesktopSmall: [979,2],
      itemsTablet : [768,1],
      lazyLoad : true,
      navigation : false,
      autoPlay : true,
      autoHeight: true
    }); 
  });
  1. If making the change above alone doesn't work in your WordPress theme, call the owl.carousel.js or owl.carousel.min.js in the head section, not in the footer
LVWS
  • 31
  • 2
  • 1
    Welcome to SO, and thanks for contributing. Answers like this need a little more explanation. You should be explaining how and why the code you've given us fixes the OP's question, and what problem the OP was really having that you have no resolved. Thanks. – Software Engineer Oct 30 '15 at 17:57