main.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. jQuery(function ($) {
  2. 'use strict';
  3. // Hide Mobile Menu On Click
  4. // Search
  5. // Progress Bar
  6. // Navigation Scroll
  7. // Sticky Nav
  8. // Parallax Scrolling
  9. // Cubeportfolio
  10. // Slick Slider
  11. // TheiaStickySidebar
  12. // Animationend
  13. // Gmap
  14. /*==============================================================*/
  15. // Animationend
  16. /*==============================================================*/
  17. (function( $ ) {
  18. //Function to animate slider captions
  19. function doAnimations( elems ) {
  20. //Cache the animationend event in a variable
  21. var animEndEv = 'webkitAnimationEnd animationend';
  22. elems.each(function () {
  23. var $this = $(this),
  24. $animationType = $this.data('animation');
  25. $this.addClass($animationType).one(animEndEv, function () {
  26. $this.removeClass($animationType);
  27. });
  28. });
  29. }
  30. //Variables on page load
  31. var $myCarousel = $('#home-carousel'),
  32. $firstAnimatingElems = $myCarousel.find('.item:first').find("[data-animation ^= 'animated']");
  33. //Initialize carousel
  34. $myCarousel.carousel({pause:"hover"});
  35. //Animate captions in first slide on page load
  36. doAnimations($firstAnimatingElems);
  37. //Pause carousel
  38. $myCarousel.carousel('pause');
  39. //Other slides to be animated on carousel slide event
  40. $myCarousel.on('slide.bs.carousel', function (e) {
  41. var $animatingElems = $(e.relatedTarget).find("[data-animation ^= 'animated']");
  42. doAnimations($animatingElems);
  43. });
  44. })(jQuery);
  45. // script end
  46. });