Advertisement
Guest User

Untitled

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