hamburger-icon-animate
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -28,6 +28,20 @@ // Script for hamburger animations | ||
hamburger.addEventListener('click', function(){ | ||
function listener() { | ||
animateIcon(ui); | ||
}); | ||
} | ||
hamburger.addEventListener('click', listener); | ||
return { | ||
toCross: function() { | ||
toCross(ui) | ||
}, | ||
toBurger: function() { | ||
toBurger(ui) | ||
}, | ||
destroy: function() { | ||
hamburger.removeEventListener('click', listener); | ||
} | ||
} | ||
} | ||
@@ -37,9 +51,5 @@ | ||
if(!ui.stateActive){ | ||
ui.stateActive = true; | ||
toCross(ui); | ||
ui.showMenu(); | ||
} else{ | ||
ui.stateActive = false; | ||
toBurger(ui); | ||
@@ -62,2 +72,3 @@ ui.hideMenu(); | ||
ui.stateActive = true; | ||
} // end of toCross() | ||
@@ -74,2 +85,3 @@ | ||
ui.stateActive = false; | ||
} // end of toBurger() | ||
@@ -76,0 +88,0 @@ |
{ | ||
"name": "hamburger-icon-animate", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Minimalist CSS3 hamburger animation", | ||
@@ -5,0 +5,0 @@ "main": "js/hamburger-icon-animate.js", |
@@ -49,3 +49,19 @@ # hamburger-icon-animate | ||
## API | ||
### hamburgerIcon([options]) | ||
Binds event handlers for animating the hamburger icon to the first element in the document matching the selector `.hia-hamburger`. | ||
An object of `options` may be given: | ||
- `showMenu`: A callback to be called each time the menu is shown (called at the *start* of the animation) | ||
- `hideMenu`: A callback to be called each time the menu is hidden (called at the *start* of the animation) | ||
```js | ||
hamburgerIcon({ | ||
showMenu: function() { console.log('showing menu'); }, | ||
hideMenu: function() { console.log('hiding menu'); } | ||
}); | ||
``` | ||
*Let me know of any issues or simply <a href="mailto:nymanchristine@gmail.com?Subject=hamburger" target="_top">say hi</a>.* |
17407
252
67