be_ui_animations.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Document : be_ui_animations.js
  3. * Author : pixelcave
  4. * Description: Custom JS code used in Animations Page
  5. */
  6. var BeUIAnimations = function() {
  7. // Animation toggle functionality
  8. var initAnimationToggle = function(){
  9. var animationClass, animationButton, currentSection;
  10. // On button click
  11. jQuery('.js-animation-section button').on('click', function(){
  12. animationButton = jQuery(this);
  13. animationClass = animationButton.data('animation-class');
  14. currentSection = animationButton.parents('.js-animation-section');
  15. // Update class preview
  16. jQuery('.js-animation-preview', currentSection).html(animationClass);
  17. // Update animation object classes
  18. jQuery('.js-animation-object', currentSection)
  19. .removeClass()
  20. .addClass('js-animation-object animated ' + animationClass);
  21. });
  22. };
  23. return {
  24. init: function() {
  25. // Init animation toggle
  26. initAnimationToggle();
  27. }
  28. };
  29. }();
  30. // Initialize when page loads
  31. jQuery(function(){ BeUIAnimations.init(); });