// Create an instance of Meny var meny = Meny.create({ // The element that will be animated in from off screen menuElement: document.querySelector( '.meny' ), // The contents that gets pushed aside while Meny is active contentsElement: document.querySelector( '.contents' ), // [optional] The alignment of the menu (top/right/bottom/left) position: Meny.getQuery().p || 'left', // [optional] The height of the menu (when using top/bottom position) height: 200, // [optional] The width of the menu (when using left/right position) width: 260, // [optional] Distance from mouse (in pixels) when menu should open threshold: 40 }); // API Methods: // meny.open(); // meny.close(); // meny.isOpen(); // Events: // meny.addEventListener( 'open', function(){ console.log( 'open' ); } ); // meny.addEventListener( 'close', function(){ console.log( 'close' ); } ); // Embed an iframe if a URL is passed in if( Meny.getQuery().u && Meny.getQuery().u.match( /^http/gi ) ) { var contents = document.querySelector( '.contents' ); contents.style.padding = '0px'; contents.innerHTML = '<div class="cover"></div><iframe src="'+ Meny.getQuery().u +'" style="width: 100%; height: 100%; border: 0; position: absolute;"></iframe>'; }
<div class="meny"> <h2>More Experiments</h2> <ul> <li><a href="http://lab.hakim.se/avgrund/">Avgrund</a></li> <li><a href="http://lab.hakim.se/radar/">Radar</a></li> <li><a href="http://lab.hakim.se/forkit-js/">forkit.js</a></li> <li><a href="http://lab.hakim.se/scroll-effects/">stroll.js</a></li> <li><a href="http://lab.hakim.se/zoom-js">zoom.js</a></li> <li><a href="http://lab.hakim.se/reveal-js">reveal.js</a></li> <li><a href="http://itunes.apple.com/us/app/sinuous/id543097218">Sinuous for iOS</a></li> <li><a href="http://hakim.se/experiments/css/domtree/">DOM Tree</a></li> <li><a href="http://hakim.se/experiments/css/holobox/">Holobox</a></li> <li><a href="http://hakim.se/experiments/html5/404/netmag.html">404</a></li> </ul> </div> <div class="meny-arrow"></div> <div class="contents"> <article> <h1>Meny</h1> <p> A three dimensional and space efficient menu. </p> <p> Move your mouse towards the arrow — or swipe in from the arrow if you're on a touch device — to open. Test it with any page by appending a URL, like so: <a href="http://lab.hakim.se/meny/?u=http://hakim.se">lab.hakim.se/meny/?u=http://hakim.se.</a> </p> <p> Meny can be positioned on any side of the screen: <br> <a href="http://lab.hakim.se/meny/?p=top">top</a> - <a href="http://lab.hakim.se/meny/?p=right">right</a> - <a href="http://lab.hakim.se/meny/?p=bottom">bottom</a> - <a href="http://lab.hakim.se/meny/?p=left">left</a> </p> <p> Instructions and download at <a href="http://github.com/hakimel/meny">github.com/hakimel/meny</a>. </p> <p> The name, <em>Meny</em>, is swedish. </p> <small> Created by <a href="http://twitter.com/hakimel">@hakimel</a> / <a href="http://hakim.se/">http://hakim.se</a> </small> </article>