On my wordpress site i use jQuery 1.12.4 together with owl carousel 2.2. When i load an carousel i get the following error:
TypeError: this.$element.attr(...) is undefined
The carousel is not working. jQuery is loadad in the header and owl carousel in the footer. I call owl carousel in a js file which is loadad after the owl carousel js:
jQuery(document).ready(function($) {
$("#services-slider").owlCarousel();
});
On my wordpress site i use jQuery 1.12.4 together with owl carousel 2.2. When i load an carousel i get the following error:
TypeError: this.$element.attr(...) is undefined
The carousel is not working. jQuery is loadad in the header and owl carousel in the footer. I call owl carousel in a js file which is loadad after the owl carousel js:
jQuery(document).ready(function($) {
$("#services-slider").owlCarousel();
});
Share
Improve this question
asked Feb 24, 2017 at 14:41
public9nfpublic9nf
1,4093 gold badges20 silver badges52 bronze badges
2
- 2 Could you please break this down into a codepen? That would be helpful. – SinDeus Commented Feb 24, 2017 at 14:52
- It has someting to do with the version of owl carousel. I now use an old owl carousel version and it works. – public9nf Commented Feb 24, 2017 at 15:25
2 Answers
Reset to default 7Just add any class to your #services-slider element. For examle
<div id="services-slider" class="owl-carousel">
....
</div>
Just minute ago have the same problem on Wordpress...
Look:
id="services-slider"
- must be only ONE element withid="services-slider"
on page- the element
id="services-slider"
must haveclass="owl-carousel"