Advertisement
ujiajah1

Previous slide 2 / puji as mamam

Aug 22nd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var main = function(){
  2.     $('.dropdown-toggle').click(function() {
  3.         $('.dropdown-menu').toggle();
  4.     });
  5.  
  6.     $('.arrow-next').click(function() {
  7.         var currentSlide = $('.active-slide');
  8.         var nextSlide = currentSlide.next();
  9.  
  10.         var currentDot = $('.active-dot');
  11.         var nextDot = currentDot.next();
  12.  
  13.          if(nextSlide.length == 0) {
  14.              nextSlide = $('.slide').first();
  15.              nextDot = $('.dot').first();
  16.          }
  17.  
  18.         currentSlide.fadeOut(600).removeClass('active-slide');
  19.         nextSlide.fadeIn(600).addClass('active-slide');
  20.  
  21.         currentDot.removeClass('active-dot');
  22.         nextDot.addClass('active-dot');
  23.     });
  24.  
  25.     $('.arrow-prev').click(function() {
  26.         var currentSlide = $('.active-slide');
  27.         var prevSlide = currentSlide.prev();
  28.  
  29.         if(prevSlide.length == 0) {
  30.            prevSlide = $('.slide').last();
  31.         }
  32.  
  33.         currentSlide.fadeOut(600).removeClass('active-slide');
  34.         prevSlide.fadeIn(600).addClass('active-slide');
  35.     });
  36. }
  37.  
  38. $(document).ready(main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement