npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

magic-burgers

v1.0.0

Published

Magic burgers is a small css library of animated hamburger menus. Also includes source sass files. Modular library and customizable, allowing you to cook your own burger!

Downloads

4

Readme

Magic burgers

Magic burgers is a small css library of animated hamburger menus inspired by this library. Also includes source sass files. Modular library and customizable, allowing you to cook your own burger!

  • The size of the minified css file with all effects - 27KB
  • The size of the source sass files - 16KB
  • The size of the minified css file with one effect - 3KB

Usage

  1. Install
npm i magic-burgers
  1. Add the following markup to the page:
<button class="hamburger">
  <span class="hamburger-inner">
    <span class="line-top">
      <span class="line-top-left"></span>
      <span class="line-top-right"></span>
    </span>
    <span class="line-center">
      <span class="line-center-left"></span>
      <span class="line-center-right"></span>
    </span>
    <span class="line-bottom">
      <span class="line-bottom-left"></span>
      <span class="line-bottom-right"></span>
    </span>
  </span>
</button>
  1. Add the class name of the type of hamburger you need:
<button class="hamburger hamburger--arrowdown">
  <span class="hamburger-inner">
    <span class="line-top">
      <span class="line-top-left"></span>
      <span class="line-top-right"></span>
    </span>
    <span class="line-center">
      <span class="line-center-left"></span>
      <span class="line-center-right"></span>
    </span>
    <span class="line-bottom">
      <span class="line-bottom-left"></span>
      <span class="line-bottom-right"></span>
    </span>
  </span>
</button>

The following classes are available:

hamburger--3d
hamburger--alchemy
hamburger--alchemy-r
hamburger--arrowdown
hamburger--arrowdown-r
hamburger--arrowturn
hamburger--arrowturn-r
hamburger--collapse
hamburger--juggler
hamburger--magic
hamburger--minify
hamburger--shurikens
hamburger--shurikens-r
hamburger--shurikens-alt
hamburger--shurikens-alt-r
hamburger--simple
hamburger--storm

Note: -r classes are reverse options ( for example, hamburger-arrowturn rotates the hamburger counterclockwise, while hamburger-arrowturn-r - clockwise )

  1. To switch the state of a hamburger, add the is-active class:
<button class="hamburger hamburger--arrowdown is-active">
  <span class="hamburger-inner">
    <span class="line-top">
      <span class="line-top-left"></span>
      <span class="line-top-right"></span>
    </span>
    <span class="line-center">
      <span class="line-center-left"></span>
      <span class="line-center-right"></span>
    </span>
    <span class="line-bottom">
      <span class="line-bottom-left"></span>
      <span class="line-bottom-right"></span>
    </span>
  </span>
</button>

Since the class name must be switched using JavaScript, in the js/hamburger.js directory is the file hamburger.js, the code in which designed for that. Just plug it in on your site page before the closing </body> tag by pasting the following code:

<script src="js/hamburger.js"></script>

Also, if you use the pug preprocessor, in the pug directory is the file hamburger.pug with an admixture that creates markup for the hamburger. Having connected the file with an admixture in your code, you can call it as follows:

+hamburger("class name")

Where the class name is the class name of the type of hamburger you need. For instance:

+hamburger("3d")
+hamburger("alchemy")
+hamburger("juggler")
+hamburger("shurikens-alt-r")

Sass

The .scss and .sass source files are available if you use the Sass preprocessor. This gives you flexibility and modularity.

  1. Import the hamburger.scss file inside your file:
@import "path/to/hamburger";
  1. Configure your hamburger - override the $hamburger-types variable to remove those types that you do not plan to use from the compiled css file.

Customization

To override the default settings, declare them before importing hamburgers:

$hamburger-layer-width: 30px;
$hamburger-layer-height: 3px;
$hamburger-layer-spacing: 5px;
$hamburger-types: (
	storm
);
@import "hamburger";

You can also create a separate file ( for example, hamburger-settings.scss ) with these settings, and then import it before the hamburgers:

@import "hamburger-settings"
@import "hamburger";

Here is the complete list of default settings ( found in sass/hamburger.scss ):

$hamburger-layer-width        : 40px;
$hamburger-layer-height       : 4px;
$hamburger-layer-spacing      : 6px;
$hamburger-padding            : 10px;
$hamburger-layer-border-radius: 4px;
$hamburger-layer-color        : #000;

// override the `$hamburger-types` variable to remove those types
// that you do not plan to use from the compiled css file
$hamburger-types: (
  simple,
  collapse,
  storm,
  juggler,
  shurikens,
  shurikens-r,
  shurikens-alt,
  shurikens-alt-r,
  minify,
  arrowturn,
  arrowturn-r,
  arrowdown,
  arrowdown-r,
  magic,
  3d,
  alchemy,
  alchemy-r
);

Browser support

Some animations use the CSSPerspective API, which is not supported in IE and Firefox. For more information, use caniuse.com.