Code Monkey home page Code Monkey logo

gravitymenu's Introduction

GravityMenu.js

GravityMenu.js is a Javascript library.
Added gravity menu icon to web pages.

Simple and Easy to use.
Pure JavaScript Library.

Using Matter.js. https://github.com/liabru/matter-js

License

The source code is licensed MIT.

Demo

https://labs.manohara.info/gravitymenu/

Usage

https://labs.manohara.info/gravitymenu/

Square is recommended for icon images.

Basic Usage

HTML

<body>
  <section id="top"></section>
  <section id="contact"></section>
  <canvas></canvas>  
</body>

<script defer src='https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.14.2/matter.min.js'></script>
<script defer src='gravitymenu_min.js'></script>

<script>
window.addEventListener('DOMContentLoaded', function() {

  garavityMenu({
    menu_list:[
      ['top','#top','image.jpg'],
      ['contact','#contact','image.jpg'],
    ],
  });

});
</script>

CSS

canvas {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

Options - Sample

<script>
window.addEventListener('DOMContentLoaded', function() {
  garavityMenu({
    canvas:'canvas',
    size:50,
    gap:5,
    menu_list:[
      ['top','#top','image.jpg'],
      ['contact','#contact','image.jpg'],
      ['social','','image.jpg'], // cond. label=='social' and social=='true'
    ],
    menu_imageSize:500,
    social:true,
    social_size:40,
    social_list:[
      ['facebook','https://www.facebook.com/sharer.php?u=[page-url]','image.jpg'],
      ['twitter','https://twitter.com/share?url=[page-url]','image.jpg'],
    ],
    social_imageSize:500,
  });
});
</script>

Parameters

canvas: canvas element, String (default: 'canvas')
size:  menu-circle diameter size, Numeric (default(px): 50)
gap: circle gap size, Numeric (default(px): 0)
menu_list: menu-circle's label,link,image-path, Array
menu_imageSize: menu-square-image original width(and height), Numeric (default(px): 500)

social: Social active flag, Boolean (default: false)
social_size: social-icon diameter size, Numeric (default(px): 40)
social_list: social-circle's label,link,image-path, Array
social_imageSize: social-square-image original width(and height), Numeric (default(px): 500)

gravitymenu's People

Contributors

happy358 avatar

Stargazers

 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.