HorizontalMenu1JS

For WAC

by Koubenec

HTML

<div class="maincontainer">
    <div id="becomemembercontainer">
        <div id="becomemember"><span id="becomemembertext">BECOME A MEMBER</span></div>
        <div id="becomemember1"><span id="becomemembertext1">SUBLINK 1</span></div>
        <div id="becomemember2"><span id="becomemembertext2">SUBLINK 2</span></div>
    </div>
    <div id="profdevcontainer">
        <div id="profdev"><span id="profdevtext">PROFESSIONAL DEVELOPMENT</span></div>
        <div id="profdev1"><span id="profdevtext1">SUBLINK 1</span></div>
        <div id="profdev2"><span id="profdevtext2">SUBLINK 2</span></div>
    </div>
</div>

CSS

.maincontainer {
width: 1005px;
height: 60px;
background-color: red;
overflow: hidden;
}

#becomemembercontainer {
width: 170px;
height: 60px;
background-color: black;
float: left;
margin-right: 3px;
}

// These properties are applied by JS instead, but included for reference // #becomemembercontainer:hover {
width: 1005px;
height: 60px;
background-color: black;
float: left;
position: absolute;
z-index: 99;
margin-right: 3px;
}

#becomemember {
width: 170px;
height: 60px;
background-color: green;
text-align: center;
line-height: 60px;
padding: 0px;
margin-right: 3px;
float: left;
}

#becomemembertext {
font-size: 16px;
}

#becomemember1 {
width: 100px;
height: 60px;
background-color: green;
text-align: center;
line-height: 60px;
padding: 0px;
margin-right: 3px;
float: left;
}

#becomemembertext1 {
font-size: 16px;
}

#becomemember2 {
width: 100px;
height: 60px;
background-color: green;
text-align: center;
line-height: 60px;
padding: 0px;
margin-right: 3px;
float: left;
}

#becomemembertext2 {
font-size: 16px;
}

#home {
width: 100px;
height: 60px;
background-color: gray;
text-align: center;
line-height: 60px;
padding: 0px 0px 0px 0px;
margin-right: 3px;
float: left;
}

#hometext {
font-size: 16px;
}

#profdevcontainer {
width: 250px;
height: 60px;
background-color: yellow;
float: left;
margin-right: 3px;
}

#profdevcontainer:hover {
/* animated wit css / width: 1005px; */
/* animated wit css / height: 60px;
/* animated wit css / background-color: yellow;
/* animated wit css / float: left; */
/* position: absolute; */
z-index: 99;
margin-right: 0px; 
}

#profdev {
width: 250px;
height: 60px;
background-color: blue;
text-align: center;
line-height: 60px;
padding: 0px;
margin-right: 3px;
float: left;
}

#profdevtext {
font-size: 16px;
}

#profdev1 {
width: 100px;
height: 60px;
background-color: blue;
text-align: center;
line-height: 60px;
padding: 0px;
margin-right: 3px;
float: left;
}

#profdevtext1 {
font-size: 16px;
}

#profdev2 {
width: 100px;
height:...

JavaScript

$(document).ready(function() {
    $("#becomemembercontainer").hover(function() {
        $(this).stop().animate({
            width: '1005px'
        }, 'fast');
    }, function() {
        $(this).stop().animate({
            width: '170px'
        }, 'fast');   
    });
});

$(document).ready(function() {
    $("#profdevcontainer").hover(function() {
        $(this).stop().animate({
            width: '1005px',
            marginLeft: '-173px',
            // 'z-index': '99'
        }, 'fast');
    }, function() {
        $(this).stop().animate({
            width: '250px',
            marginLeft: '0px'
        }, 'fast');   
    });
});

    // $('#clickme').hover(function() {
    // $('#book').animate({
    // opacity: 0.25,
    // left: '+=50',
    // height: 'toggle'
    // }, 5000, function() {
    // Animation complete.
    // });
    // });