Giter Site home page Giter Site logo

menufy's Introduction

menufy.js

Less than 30 lines of code and comments to generate a dynamic html menu based on each id located in the page

Menufy.js scrapes an html doc to find its ids, and generates a menu that allows you to move from section to section in the page seamlessly. It is ideal for simple html blog pages that can become very long with no easy way to jump from post to post. The script is written in vanilla javascript requiring no libraries to run. All that is required in the HTML is:

<ul id="mainNav"></ul>

The menu will be appended to this element and will populate from top to bottom. Each id is cleaned up for display and appears without hyphens to improve readbility. a sample use of this code can be found at and a sample css sheet can be found in this repository.

To include the script and stylesheet in your html put the following two lines in the of your html:

<link href="your/path/here/menufy.css" rel="stylesheet" type="text/css">
<script src="your/path/here/menufy.js" type="text/javascript"></script>

It is recommended that you include the id '#top' at the top of your page to allow users to return to the top easily.

menufy's People

Contributors

davidmoed avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.