, , , , , -, . expandMenu() collapseMenu() jQuery, / $(this).expandMenu();. collapseMenu() click(), , , .
: http://jsfiddle.net/sqCN5/4/
CSS
span{
position: absolute;
}
.box1{
width:40px;
height:13px;
float:left;
font-size:.6em;
color:#fff;
background:#99CC00;
font-family:Arial, Helvetica, sans-serif;
}
.box2{
top:25px;
width:40px;
height:auto;
font-size:.6em;
color:#fff;
background:#FF6600;
font-family:Arial, Helvetica, sans-serif;
margin-top:1px;
opacity:.8;
filter: alpha(opacity=75);
}
JS
$('span').hover(function() {
$(this).expandMenu();
}, function() {
$(this).collapseMenu();
}).click(function(){
$(this).collapseMenu();
});
$.fn.collapseMenu= function() {
$(this)
.stop()
.css({
'border': '0px'
})
.fadeIn('slow')
.animate({
width: '40px',
height: '13px',
padding: '0px'
}, 700,'swing', function(){
$(this).css({'z-index': '0'});
});
return ($(this));
};
$.fn.expandMenu= function() {
$(this)
.stop()
.css({
'z-index': '999999',
'border' : '1px solid #000'
})
.animate({
width: '200px',
height: '125px',
padding: '0px'
}, 700, 'swing');
return ($(this));
};