Sliding Menu for script.aculo.us

Sliding Menu for script.aculo.us

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
401 views

It’s been a while since the original post Sexy sliding JavaScript side bar menu using mootools so I decided it was about time I pulled my finger out and developed a sliding menu using script.aculo.us.

Well here goes…

Usage of this script is very easy.

Documentation:

CSS:

a{
    outline: none;
}

a:active{
    outline: none;
}

#sideBar{
text-align:left;
}

#sideBar h2{
    color:#FFFFFF;
    font-size:110%;
    font-family:arial;
    margin:10px 10px 10px 10px;
    font-weight:bold !important;
}

#sideBar h2 span{
    font-size:125%;
    font-weight:normal !important;
}

#sideBar ul{
    margin:0px 0px 0px 0px;
    padding:0px 0px 0px 0px;
}

#sideBar li{
    margin:0px 10px 3px 10px;
    padding:2px;
    list-style-type:none;
    display:block;
    background-color:#DA1074;
    width:177px;
    color:#FFFFFF;
}

#sideBar li a{
    width:100%;
}

#sideBar li a:link,
#sideBar li a:visited{
    color:#FFFFFF;
    font-family:verdana;
    font-size:100%;
    text-decoration:none;
    display:block;
    margin:0px 0px 0px 0px;
    padding:0px;
    width:100%;
}

#sideBar li a:hover{
    color:#FFFFFF;
    text-decoration:underline;
}

#sideBar{
    position: absolute;
    width: auto;
    height: auto;
    top: 140px;
    right:0px;
    background-image:url(images/background.gif);
    background-position:top left;
    background-repeat:repeat-y;
}

#sideBarTab{
    float:left;
    height:137px;
    width:28px;
}

#sideBarTab img{
    border:0px solid #FFFFFF;
}

#sideBarContents{
    float:left;
    overflow:hidden !important;
    width:200px;
    height:320px;
}

#sideBarContentsInner{
    width:200px;
}

HTML:

<div id="sideBar">

    <a href="#" id="sideBarTab">
        <img src="images/slide-button.gif" alt="sideBar" title="sideBar" />
    </a>

    <div id="sideBarContents" style="width:0px;">
        <div id="sideBarContentsInner">
            <h2>side<span>bar</span></h2>

            <ul>
                <li><a href="#">Link One</a></li>
                <li><a href="#">Link Two</a></li>
                <li><a href="#">Link Three</a></li>
                <li><a href="#">Link Four</a></li>
                <li><a href="#">Link Five</a></li>
            </ul>

        </div>
    </div>

</div> 

As shown the code is not overly complex. The HTML comprises a containing DIV (with an ID of sideBar), then within this we have a linked tab image (with an ID of sideBarTab) followed by the contents of the side bar contained in a DIV (with an ID of sideBarContents) and sub contained within another DIV (with an ID of sideBarContentsInner).

The sideBarContents DIV has an inline style applied setting the width to zero. This is to allow the JavaScript to resize the region using script.aculo.us (Some browsers are a bit buggy when trying to change styles that are set in an external stylesheet). This DIV is also set to have an overflow hidden producing the effect that the content is sliding in.

Points to note within the CSS include the width set on the sideBarContentsInner DIV. This width should be adjusted as required to meet your deign requirements (It is set to 200px for the purpose of the demonstration).

Also to reposition the bar simply adjust the postioning styles applied on the sideBar DIV (i.e. right and top).

Finally you will need to include effects.js and side-bar.js to the head of the document in the order shown for this to work. Have a play with the demo below and download the code.

Demo: http://www.andrewsellick.com/examples/sliding-side-bar-scriptaculous/

Download: http://www.andrewsellick.com/examples/sliding-side-bar-scriptaculous/sliding-side-bar-scriptaculous.rar

Source: http://www.andrewsellick.com/44/sexy-sliding-menu-for-scriptaculous#

http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/stumbleupon_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/delicious_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/blinklist_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/furl_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/technorati_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/magnolia_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/google_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/myspace_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/facebook_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/sphinn_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/mixx_32.png http://www.ajaxupdates.com/wp-content/plugins/sociofluid/images/twitter_32.png

Related Listings:

  1. Sliding Box Script As part of the design of this site, I’m using...
  2. Sliding RSS Feed Script A great, slick way to display RSS feeds. Nice and...
  3. Script.aculo.us 1.7 beta Script script.aculo.us 1.7 beta 1 is out now (see below!)—and the...
  4. Control ProgressBar Script Control.ProgressBar is a percentage based progress bar that can be...
  5. Fancy Sliding Tabs Menu The Fancy Sliding Tab Menu is back and better than...

Do you like this post?

Email:     

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , ,

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment



Web Design & CSS (Templates) - TOP.ORG