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