Permalink
Find file
6ec58a4 Mar 2, 2014
53 lines (29 sloc) 3.08 KB

Fixed Responsive Nav

Responsive, fixed and touch friendly one page navigation, using Responsive Nav, smooth animated scrolling & vanilla JavaScript. Similar to the solution we are using on Adtile’s site.

To see the source code, open up fixed-responsive-nav.js located under the "js" folder. The file should be pretty well commented out to explain what’s happening on each line. If you have any questions or problems, tweet to us! This project is built using progressive enhancement and tested to be working on Internet Explorer 6 and up.

You are free to use the JavaScript, styles and the icon fonts provided here in your own project. Commercial or non-commercial.

Features

  • Fixed positioned, always visible navigation bar
  • Uses vanilla JavaScript, no jQuery required
  • Smooth animated scrolling
  • Removes 300ms tap delay
  • Adds a mask over the content when navigation is open
  • Auto highlights current location
  • Uses a tiny custom font for icons (only two characters included)
  • Closes the navigation when user tap's outside of it
  • Tapping a link changes the URL, so you can still copy/paste it and link to different sections
  • Built progressive enhancement in mind

Live example

Working on the project

Doesn’t require any setting up, just clone the repository and open index.html in your favorite browser. If you are using OS X, you can start a server from your command line using the following command, and then view the page at http://localhost:8000:

python -m SimpleHTTPServer 8000

License

Licensed under the MIT license.

Copyright (c) 2014 Adtile, http://www.adtile.me/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.