Sha256: c41bd5634da40e5e51aac276e1c5fd9e13f336bef47f1b230bc592643d85ff01

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

var ActionBar = (function($) {
  'use strict';

   /*
  * Manage responsive Action Bar component - moves the unnecessary elements to a separate menu.
  * @params: -
  * @return: undefined
  */
  var _responsiveActionBar = function() {
    var resizing = false;
    var $actionBar = $('.action-bar');
    var $actionRemove = $actionBar.find('.action-remove');

    function _detachElements(elements) {
      $(elements).detach();
    }
     
    var moveActionBarElement = Util.debounce(function() {

      if($actionRemove.length) {
        $actionBar.each(function(index, el) {
          var $elToRemove = $(el).find('.action-remove');
          var $actionHolder = $(el).find('.action-nav-menu');
          var $header = $('.main-navigation-header');

          var dataAttrs = [];
          $elToRemove.each(function(index, el) {
            dataAttrs.push($(el).data('position'));
          });

          if ( Modernizr.mq("only screen and (max-width: 1070px)")) {
            _detachElements($elToRemove);
            $elToRemove.appendTo($actionHolder);
          } else if ( Modernizr.mq("only screen and (min-width: 1071px)") ) {
            _detachElements($elToRemove);
            $elToRemove.each(function(index, el) {
              $(el).appendTo($elToRemove.eq(0));
            });
            $header.find('.nav-logo').after($elToRemove);
          }
        });

        resizing = false;
      }

    }, 200);

    moveActionBarElement();
    $(window).on('resize', function() {
      if( !resizing ) {
        window.requestAnimationFrame(moveActionBarElement);
        resizing = true;
      }
    });
  };

  var init = function() {
    _responsiveActionBar();
  };

  return {
    init: init
  };
  
})(jQuery);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lato_view-1.1.5 app/assets/javascripts/lato_view/build/ActionBar.js
lato_view-1.1.4 app/assets/javascripts/lato_view/build/ActionBar.js
lato_view-1.1.3 app/assets/javascripts/lato_view/build/ActionBar.js
lato_view-1.1 app/assets/javascripts/lato_view/build/ActionBar.js