Javascript – HTML Slide Menu for a Mobile HTML Page?

csshtmljavascriptjquerymobile

I want to make a slide menu for a mobile html page.

Is there a jquery library still able to do that? How can I do this myself?

There should be a menu button on the top left of the screen.
enter image description here

If I tap the menu button the content should slide to the right and the menu bar would appears on the left.

enter image description here

Best Answer

Refer this page to get details

http://www.berriart.com/sidr/

https://github.com/donwalter/jquery-mobile-slide-menu

Include the following files:

<link rel="stylesheet" href="css/jquery-mobile-slide-menu.css" type="text/css" />
<script type="text/javascript" src="js/jquery-mobile-slide-menu.js"></script>

Then insert your menu, before your tag:

<div id="side-menu">
    <ul>
        <li><a href="/">Main</a><span class="icon"></span></li>
        <li><a href="/page-2/">Page 2</a><span class="icon"></span></li>
        <li><a href="/page-3/">Page 3</a><span class="icon"></span></li>
        <li><a href="/page-4/">Page 4</a><span class="icon"></span></li>
    </ul>
</div>

Then add this to initiate the menu:

$(function(){
    $('#side-menu').slideMenu();
});

DEMO