Last active
May 10, 2023 05:07
-
-
Save azizultex/e69b7497b2eb8f7ceb9247f0619baf17 to your computer and use it in GitHub Desktop.
Custom Class to Slick Carousel Next Prev Items and animation
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
| /* | |
| Site sample: http://nysi.co/ | |
| */ | |
| (function($) { | |
| "use strict"; | |
| jQuery(document).ready(function($) { | |
| $('#slider').slick({ | |
| centerMode: true, | |
| centerPadding: '100px', | |
| slidesToShow: 1, | |
| autoplay: true, | |
| autoplaySpeed: 10000, | |
| infinite: true, | |
| responsive: [{ | |
| breakpoint: 768, | |
| settings: { | |
| arrows: false, | |
| centerMode: true, | |
| centerPadding: '50px', | |
| slidesToShow: 1 | |
| } | |
| }, { | |
| breakpoint: 480, | |
| settings: { | |
| arrows: false, | |
| centerMode: false, | |
| slidesToShow: 1 | |
| } | |
| }] | |
| }); | |
| function add_class() { | |
| $('.caption').removeClass('animated fadeInLeft fadeInRight pulse previous_caption next_caption'); | |
| $('.slick-current .caption').addClass('animated pulse', function() { | |
| var prev = $('.slick-current').prev().find('.caption').addClass('previous_caption'); | |
| var next = $('.slick-current').next().find('.caption').addClass('next_caption'); | |
| prev.addClass('animated fadeInLeft'); | |
| next.addClass('animated fadeInRight'); | |
| }); | |
| // $('.slick-slide').removeClass('Custom-Prev').removeClass('Custom-Next'); | |
| // prev.addClass('Custom-Prev'); | |
| // next.addClass('Custom-Next'); | |
| } | |
| $('#slider').on('swipe', function(event, slick, direction) { | |
| add_class(); | |
| }); | |
| $('#slider').on('afterChange', function(event, currentSlide) { | |
| add_class(); | |
| }); | |
| add_class(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment