Sha256: cbb36e51684e1036904a1c15badc4d4ef53549a811120809451102f9145d6c9b

Contents?: true

Size: 1.18 KB

Versions: 54

Compression:

Stored size: 1.18 KB

Contents

/**
 * Hamburgers plugin helper.
 *
 * @author Htmlstream
 * @version 1.0
 * @requires hamburgers.min.css
 *
 */
;(function($){
	'use strict';

	$.HSCore.helpers.HSHamburgers = {

		/**
		 * Initialize 'hamburgers' plugin.
		 * 
		 * @param String selector
		 *
		 * @return undefined;
		 */
		init: function(selector) {

			if( !selector || !$(selector).length ) return;

		  var hamburgers = $(selector),
		  		timeoutid;

		  hamburgers.each(function(i, el){

		  	var $this = $(this);

		  	if($this.closest('button').length) {
		  		$this.closest('button').get(0).addEventListener('click', function(e){

		  			var $self = $(this),
		  					$hamburger = $self.find(selector);

		  			if(timeoutid) clearTimeout(timeoutid);
		  			timeoutid = setTimeout(function(){

		  				$hamburger.toggleClass('is-active');

		  			}, 10);
		  			e.preventDefault();
		  		}, false);
		  	}
		  	else {
		  		$this.get(0).addEventListener('click', function(e){

		  			var $self = $(this);

		  			if(timeoutid) clearTimeout(timeoutid);
		  			timeoutid = setTimeout(function(){

		  				$self.toggleClass('is-active');

		  			}, 10);
		  			e.preventDefault();
		  		}, false);
		  	}

		  });

		}
		

	};

})(jQuery);

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
jekyll-theme-glueckkanja-1.2.29 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.28 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.27 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.26 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.25 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.24 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.23 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.22 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.21 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.20 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.19 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.18 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.17 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.16 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.15 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.14 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.13 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.12 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.11 assets/js/helpers/hs.hamburgers.js
jekyll-theme-glueckkanja-1.2.10 assets/js/helpers/hs.hamburgers.js