Sponsors



Go Back   Zune Boards > Help Forum > Tutorials

New Member?



 
Register Zunecentive FAQ Members List Calendar Search Today's Posts Mark Forums Read

Tutorials A collection of tutorials to help you with various programs.

Reply
 
LinkBack Thread Tools
Old 11-10-2007, 01:01 PM   #1 (permalink)
lacrosse_man16
 
Posts: n/a
$zB:
Donate
Default [SOLVED] Javascript Sliding Bar


Just enter the following codes and this is what you should expect to see. *Above*

Now for this solution I decided to use mootools due to the smoothness of their effects, however, this could just as easily be developed in script.aculo.us or other JavaScript libraries.

Programs Used:
-Aptana
-MooTools
*Notepad++ Works too.

CSS Code
HTML Code:
body{
        position:relative;
        paddign:0px;
        font-size:100%;
    }
    
    h2{
        color:#FFFFFF;
        font-size:90%;
        font-family:arial;
        margin:10px 10px 10px 10px;
        font-weight:bold;
    }
   
    h2 span{
        font-size:105%;
        font-weight:normal;
    }
   
    ul{
        margin:0px 0px 0px 0px;
        padding:0px 0px 0px 0px;
    }
   
    li{
        margin:0px 10px 3px 10px;
        padding:2px;
        list-style-type:none;
        display:block;
        background-color:#DA1074;
        width:177px;
    }
   
    li a{
        width:100%;
    }
   
    li a:link,
    li a:visited{
        color:#FFFFFF;
        font-family:verdana;
        font-size:70%;
        text-decoration:none;
        display:block;
        margin:0px 0px 0px 0px;
        padding:0px;
        width:100%;
    }
   
    li a:hover{
        color:#FFFFFF;
        text-decoration:underline;
    }
   
    #sideBar{
        position: absolute;
        width: auto;
        height: auto;
        top: 200px;
        right:-7px;
        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{
        overflow:hidden !important;
    }
   
    #sideBarContentsInner{
        width:200px;
    }
HTML Code
HTML Code:
<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 mootools (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 mootools.js and side-bar.js to the head of the document in the order shown for this to work.

Download the Code



  Reply With Quote
Remove Advertisements Sponsored Links
Advertisement
 
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Register and remove this ad

All times are GMT -8. The time now is 08:04 PM.

 
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC8
vB Ad Management by =RedTyger=
(C) ZuneBoards 2006-2007
Copyright © 2006 - 2008 Zune Boards | About Zune Boards | Legal | A member of the Crowdgather Forum Community