Pushy is a responsive off-canvas navigation menu using CSS transforms & transitions.
See the codePushy is a responsive off-canvas navigation menu using CSS transforms & transitions. This project was inspired by the off-canvas navigation menu seen on Medium.
Pushy has been implemented on many sites, check them out! Feel free to contact me if you use Pushy in one of your websites.
Pushy has been featured on the Treehouse Show, in a book and used in Antarctica!
Download the latest release, this includes everything you need to get Pushy running on your site.
Add the stylesheet (pushy.css) in your head and the JS (pushy.min.js) file in your footer.
If you are using submenus, then you'll need to add the arrow.svg file into your img directory (optional).
Insert the following markup into your body.
<!-- Pushy Menu -->
<nav class="pushy pushy-left" data-focus="#focus-link">
<div class="pushy-content">
<ul>
<li class="pushy-submenu">
<button id="focus-link">Submenu</button>
<ul>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
</ul>
</li>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
</ul>
</div>
</nav>
<!-- Site Overlay -->
<div class="site-overlay"></div>
<!-- Your Content -->
<div class="container">
<!-- Menu Button -->
<button class="menu-btn">☰ Menu</button>
</div>
Alternatively link directly to Pushy files on cdnjs.
If your are comfortable with command line, you can install Pushy as a NPM package:
npm install @cmyee/pushy
Pushy CSS and JS are compiled and minified using Grunt. You'll need Node and Grunt installed globally.
From the root directory run:
$ npm install
$ grunt
Now you can edit files in /scss/ and /js/, which will be compiled to /css/pushy.css and /js/pushy.min.js.
Use the .pushy-left or .pushy-right CSS class to specify the menu position.
<!-- Pushy will transition from the right -->
<nav class="pushy pushy-right">
<div class="pushy-content">
<ul>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
</ul>
</div>
</nav>
Use the data-focus attribute to give focus to a link when the menu is opened. Ideally the first link of the menu should be focused.
This data attribute accepts a CSS selector.
<nav class="pushy pushy-left" data-focus="#focus-link">
<div class="pushy-content">
<ul>
<li><a href="#" id="focus-link">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</nav>
Use the data-menu-btn-selector attribute to change the menu button CSS class for toggling the menu.
By default Pushy will use .menu-btn to toggle the menu.
This data attribute accepts a CSS selector.
Note: In v1.4.0 this attribute was renamed from data-menu-btn-class to data-menu-btn-selector
<!-- Pushy Menu -->
<nav class="pushy pushy-left" data-menu-btn-selector=".my-menu-btn">
<!-- I've removed the inner markup for brevity -->
</nav>
<!-- Menu Button-->
<button class="my-menu-btn">Menu</button>
.push CSS class on HTML elements outside of the .container.<header class="push">
<h1>This is a Heading</h1>
<h2>This is a subheading</h2>
</header>
<!-- Your Content -->
<div class="container"></div>
$menu_width variable. The SCSS file will need to be compiled to CSS in order to see the change.$menu_width: 400px;
pushy.css file.
.pushy{
width: 400px; /* Changed the width to 400px */
}
.pushy-left{
transform: translate3d(-400px,0,0); /* Updated the values */
/* Don't forget the vendor prefixes */
}
.pushy-open-left .container,
.pushy-open-left .push {
transform: translate3d(400px, 0, 0); /* Updated the values */
}
.pushy-right {
transform: translate3d(400px, 0, 0); /* Updated the values */
/* Don't forget the vendor prefixes */
}
.pushy-open-right #.container,
.pushy-open-right .push {
transform: translate3d(-400px, 0, 0); /* Updated the values */
/* Don't forget the vendor prefixes */
}
html, body{
overflow-x: hidden;
height: 100%;
-webkit-overflow-scrolling: touch;
}
Pushy has been implemented on many sites in the wild, check them out!
To add your site, contact me.
29 followers · starred Feb 2015
12 followers · starred Aug 2014
12 followers · starred Sep 2016
25 followers · starred Aug 2014
Pushy is a responsive off-canvas navigation menu using CSS transforms & transitions.
See the codePushy is a responsive off-canvas navigation menu using CSS transforms & transitions. This project was inspired by the off-canvas navigation menu seen on Medium.
Pushy has been implemented on many sites, check them out! Feel free to contact me if you use Pushy in one of your websites.
Pushy has been featured on the Treehouse Show, in a book and used in Antarctica!
Download the latest release, this includes everything you need to get Pushy running on your site.
Add the stylesheet (pushy.css) in your head and the JS (pushy.min.js) file in your footer.
If you are using submenus, then you'll need to add the arrow.svg file into your img directory (optional).
Insert the following markup into your body.
<!-- Pushy Menu -->
<nav class="pushy pushy-left" data-focus="#focus-link">
<div class="pushy-content">
<ul>
<li class="pushy-submenu">
<button id="focus-link">Submenu</button>
<ul>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a></li>
</ul>
</li>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
</ul>
</div>
</nav>
<!-- Site Overlay -->
<div class="site-overlay"></div>
<!-- Your Content -->
<div class="container">
<!-- Menu Button -->
<button class="menu-btn">☰ Menu</button>
</div>
Alternatively link directly to Pushy files on cdnjs.
If your are comfortable with command line, you can install Pushy as a NPM package:
npm install @cmyee/pushy
Pushy CSS and JS are compiled and minified using Grunt. You'll need Node and Grunt installed globally.
From the root directory run:
$ npm install
$ grunt
Now you can edit files in /scss/ and /js/, which will be compiled to /css/pushy.css and /js/pushy.min.js.
Use the .pushy-left or .pushy-right CSS class to specify the menu position.
<!-- Pushy will transition from the right -->
<nav class="pushy pushy-right">
<div class="pushy-content">
<ul>
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
</ul>
</div>
</nav>
Use the data-focus attribute to give focus to a link when the menu is opened. Ideally the first link of the menu should be focused.
This data attribute accepts a CSS selector.
<nav class="pushy pushy-left" data-focus="#focus-link">
<div class="pushy-content">
<ul>
<li><a href="#" id="focus-link">Home</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</nav>
Use the data-menu-btn-selector attribute to change the menu button CSS class for toggling the menu.
By default Pushy will use .menu-btn to toggle the menu.
This data attribute accepts a CSS selector.
Note: In v1.4.0 this attribute was renamed from data-menu-btn-class to data-menu-btn-selector
<!-- Pushy Menu -->
<nav class="pushy pushy-left" data-menu-btn-selector=".my-menu-btn">
<!-- I've removed the inner markup for brevity -->
</nav>
<!-- Menu Button-->
<button class="my-menu-btn">Menu</button>
.push CSS class on HTML elements outside of the .container.<header class="push">
<h1>This is a Heading</h1>
<h2>This is a subheading</h2>
</header>
<!-- Your Content -->
<div class="container"></div>
$menu_width variable. The SCSS file will need to be compiled to CSS in order to see the change.$menu_width: 400px;
pushy.css file.
.pushy{
width: 400px; /* Changed the width to 400px */
}
.pushy-left{
transform: translate3d(-400px,0,0); /* Updated the values */
/* Don't forget the vendor prefixes */
}
.pushy-open-left .container,
.pushy-open-left .push {
transform: translate3d(400px, 0, 0); /* Updated the values */
}
.pushy-right {
transform: translate3d(400px, 0, 0); /* Updated the values */
/* Don't forget the vendor prefixes */
}
.pushy-open-right #.container,
.pushy-open-right .push {
transform: translate3d(-400px, 0, 0); /* Updated the values */
/* Don't forget the vendor prefixes */
}
html, body{
overflow-x: hidden;
height: 100%;
-webkit-overflow-scrolling: touch;
}
Pushy has been implemented on many sites in the wild, check them out!
To add your site, contact me.
29 followers · starred Feb 2015
12 followers · starred Aug 2014
12 followers · starred Sep 2016
25 followers · starred Aug 2014