scrolltoggle/index.js
function ScrollToggle(el, config) {
  this.el_ = el;

  this.config_ = objects.clone(config);
  if (this.el_.hasAttribute('data-ak-scrolltoggle')) {
    var elConfig = JSON.parse(this.el_.getAttribute('data-ak-scrolltoggle'));
    if (elConfig && typeof elConfig === 'object') {
      objects.merge(this.config_, elConfig);
    }
  }

  // Initialize the current scroll position.
  this.lastScrollPos_ = 0;
  this.onScroll();
}
function ScrollToggle(el, config) {
  this.el_ = el;

  this.config_ = objects.clone(config);
  if (this.el_.hasAttribute('data-ak-scrolltoggle')) {
    var elConfig = JSON.parse(this.el_.getAttribute('data-ak-scrolltoggle'));
    if (elConfig && typeof elConfig === 'object') {
      objects.merge(this.config_, elConfig);
    }
  }

  // Initialize the current scroll position.
  this.lastScrollPos_ = 0;
  this.onScroll();
}
function ScrollToggle ( el , config ) { this . el_ = el ; this . config_ = objects . clone ( config ) ; if ( this . el_ . hasAttribute ( 'data-ak-scrolltoggle' ) ) { var elConfig = JSON . parse ( this . el_ . getAttribute ( 'data-ak-scrolltoggle' ) ) ; if ( elConfig && typeof elConfig === 'object' ) { objects . merge ( this . config_ , elConfig ) ; } } // Initialize the current scroll position. this . lastScrollPos_ = 0 ; this . onScroll ( ) ; }
Toggles a class on an element when a scroll direction has been detected.
@param {Element} el The element.
@param {Object} config Config options.
@constructor
Toggles a class on an element when a scroll direction has been detected .