admin管理员组文章数量:1391990
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"
本文标签: javascriptOwl carouselTypeError thiselementattr() is undefinedStack Overflow
版权声明:本文标题:javascript - Owl carousel - TypeError: this.$element.attr(...) is undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744738225a2622458.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论