Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple Menys per page #41

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 33 additions & 35 deletions css/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,39 +90,39 @@ h2 {
-o-transition: opacity 0.4s ease 0.4s;
transition: opacity 0.4s ease 0.4s;
}
.meny-left .meny-arrow {
left: 14px;
top: 50%;
margin-top: -16px;
border-left: 16px solid #333;
}
.meny-right .meny-arrow {
right: 14px;
top: 50%;
margin-top: -16px;
border-right: 16px solid #333;
}
.meny-top .meny-arrow {
left: 50%;
top: 14px;
margin-left: -16px;
border-top: 16px solid #333;
}
.meny-bottom .meny-arrow {
left: 50%;
bottom: 14px;
margin-left: -16px;
border-bottom: 16px solid #333;
}
.meny-active .meny-arrow {
opacity: 0;

-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-ms-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
.meny-arrow.left {
left: 14px;
top: 50%;
margin-top: -16px;
border-left: 16px solid #333;
}
.meny-arrow.right {
right: 14px;
top: 50%;
margin-top: -16px;
border-right: 16px solid #333;
}
.meny-arrow.top {
left: 50%;
top: 14px;
margin-left: -16px;
border-top: 16px solid #333;
}
.meny-arrow.bottom {
left: 50%;
bottom: 14px;
margin-left: -16px;
border-bottom: 16px solid #333;
}
.meny-active .meny-arrow {
opacity: 0;
-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-ms-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}

/**
* Main contents area
Expand All @@ -132,7 +132,6 @@ h2 {
padding: 20px 40px;
width: 100%;
height: 100%;
overflow-y: auto;

-webkit-overflow-scrolling: touch;
-webkit-transform-style: preserve-3d;
Expand Down Expand Up @@ -164,4 +163,3 @@ h2 {
bottom: 20px;
}


115 changes: 80 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,52 @@

<body>

<div class="meny">
<div class="meny left">
<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 right">
<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 top">
<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 bottom">
<h2>More Experiments</h2>
<ul>
<li><a href="http://lab.hakim.se/avgrund/">Avgrund</a></li>
Expand All @@ -34,7 +79,10 @@ <h2>More Experiments</h2>
</ul>
</div>

<div class="meny-arrow"></div>
<div class="meny-arrow left"></div>
<div class="meny-arrow right"></div>
<div class="meny-arrow top"></div>
<div class="meny-arrow bottom"></div>

<div class="contents">
<article>
Expand All @@ -43,15 +91,11 @@ <h1>Meny</h1>
A three dimensional and space efficient menu.
</p>
<p>
Move your mouse towards the arrow &mdash; or swipe in from the arrow if you're on a touch device &mdash; to open.
Move your mouse towards one of the arrows &mdash; or swipe in from the arrows if you're on a touch device &mdash; 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>
Meny can be positioned on any side of the screen and you can even have multiple per page!
</p>
<p>
Instructions and download at <a href="http://github.com/hakimel/meny">github.com/hakimel/meny</a>.
Expand All @@ -75,32 +119,33 @@ <h1>Meny</h1>

<script src="js/meny.js"></script>
<script>
// 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,

// [optional] Use mouse movement to automatically open/close
mouse: true,

// [optional] Use touch swipe events to open/close
touch: true
});
['left','right','top','bottom'].forEach(function(pos) {
Meny.create({
// The element that will be animated in from off screen
menuElement: document.querySelector( '.meny.' + pos ),

// 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: pos,

// [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,

// [optional] Use mouse movement to automatically open/close
mouse: true,

// [optional] Use touch swipe events to open/close
touch: true
});
});

// API Methods:
// meny.open();
Expand All @@ -122,4 +167,4 @@ <h1>Meny</h1>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

</body>
</html>
</html>
Loading