Created
November 17, 2019 02:39
-
-
Save matt5346/78badebf1886f0284c6fe1973546e54a to your computer and use it in GitHub Desktop.
only mobile owl carousel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function postsCarousel() { | |
| var checkWidth = $(window).width(); | |
| var owlPost = $("#latest-posts .posts-wrapper"); | |
| if (checkWidth > 767) { | |
| if(typeof owlPost.data('owl.carousel') != 'undefined'){ | |
| owlPost.data('owl.carousel').destroy(); | |
| } | |
| owlPost.removeClass('owl-carousel'); | |
| } else if (checkWidth < 768) { | |
| owlPost.addClass('owl-carousel'); | |
| owlPost.owlCarousel({ | |
| items : 1, | |
| slideSpeed : 500, | |
| animateOut: 'fadeOut', | |
| touchDrag: false, | |
| mouseDrag: false, | |
| autoplay: true, | |
| autoplaySpeed: 8000, | |
| autoplayTimeout: 8000, | |
| dots: true, | |
| loop: true | |
| }); | |
| } | |
| } | |
| postsCarousel(); | |
| $(window).resize(postsCarousel); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment