javascript - Click button and Side Menu slide out from hidden - Stack Overflow

I want to make a similar navigation menu like what m.facebook did.but this, i want to make it nicely a

I want to make a similar navigation menu like what m.facebook did. but this, i want to make it nicely animated slide out from left side of the website.

Flow :: Click a button > (Menu is hidden by default) Menu Slide out, push the main container to right a bit to fit the menu > Click again > Menu Slide in and hidden again.

I got no idea to make it with javascript or jquery or ajax while i'm new to web development and there are too much of effect scripting language. May i know to achieve this, which is perfect in smoothness ?

I want to make a similar navigation menu like what m.facebook. did. but this, i want to make it nicely animated slide out from left side of the website.

Flow :: Click a button > (Menu is hidden by default) Menu Slide out, push the main container to right a bit to fit the menu > Click again > Menu Slide in and hidden again.

I got no idea to make it with javascript or jquery or ajax while i'm new to web development and there are too much of effect scripting language. May i know to achieve this, which is perfect in smoothness ?

Share Improve this question asked Feb 28, 2012 at 7:16 1myb1myb 3,59212 gold badges56 silver badges75 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Something along these lines... http://jsfiddle/HfdXY/

HTML:

<div id="menu">Menu</div>

<button id="openMenu">Toggle menu</button>​

CSS:

#menu {
    height: 300px;
    width: 0px;
    border: 1px solid black;
    display: none;
}​

JS:

$("#openMenu").click(function() {
    var menu = $("#menu");
    if ($(menu).is(":visible")) {
        $(menu).animate({width: 0}, 1000, function() {$(menu).hide();});
    } else {
        $(menu).show().animate({width: 100}, 1000);           
    }
});​

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744346293a4569704.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信