I have a drop down menu. Its height is animated with jQuery from 5px to 130px and vice versa.
The menu worked fine when it was separated by an element (when I developed it), but when other elements appeared Opera made a surprise:
alt text http://img12.imageshack.us/img12/9366/menusy.png
I marked the first state as 1 and the second as 2. The third state should be the same as the first, but, as you can see, it has a tail.
UPD: source code
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/jquery.js">
</script>
<script type="text/javascript" src="js/script.js">
</script>
<script type="text/javascript">
$(function(){
init();
});
</script>
<link rel="stylesheet" href="css/styles.css"/>
</head>
<body>
<div id="side" class="side_outer">
<div class="cn tr"> </div>
<div class="cn tl"> </div>
<div class="auth">
<span class="auth_entr">Click me</span>
<div class="auth_fields">
</div>
<div id="auth_separator"> </div>
</div>
<div class="side_inner">
<div class="cn tr"> </div>
<div class="cn tl"> </div>
<div class="side_content">
Some content
</div>
<div class="cn br"> </div>
<div class="cn bl"> </div>
</div>
<div class="cn br"> </div>
<div class="cn bl"> </div>
</div>
<div id="header"> Header</div>
<div id="central"> Center</div>
</body>
</html>
CSS
#header {
background: red;
height: 100px;
margin: 30px 330px 20px 20px;
}
#central {
background: green;
height: 150px;
margin: 20px 330px 20px 20px;
}
#side {
margin-right: 3%;
margin-left: 10px;
margin-top: 30px;
min-width: 200px;
float: right;
}
.side_outer {
padding: 0 10px;
background: #f2f2cc;
width: 22%;
border-bottom-style: dashed;
border-bottom-width: 2px;
border-bottom-color: black;
}
.side_inner {
position:relative;
overflow:hidden;
padding: 0 10px;
background: #accbfa;
}
.side_outer .cn {
position: relative;
width: 20px;
height: 20px;
}
.side_outer .cn.tr, .side_outer .cn.br {
float: right;
left: 10px;
}
.side_outer .cn.tl, .side_outer .cn.bl {
left: -10px;
}
.auth {
overflow: hidden;
}
.auth_entr {
position: relative;
top: 5px;
margin-left: 17px;
padding: 0 5px;
color: #1e5ebe;
cursor: pointer;
}
.auth_fields {
overflow: hidden;
height: 5px;
margin-top: 5px;
}
#auth_separator {
height: 6px;
font-size: 2px;
}
.side_content {
height: 100px;
padding: 5px 15px;
}
JavaScript:
var auth_state = 1;
function init () {
$('span.auth_entr').click (function (){
auth_state = (auth_state + 1) % 2;
if (auth_state == 1) {
$('div.auth_fields').animate({height: '5px'}, 1000);
} else {
$('div.auth_fields').animate({height: '132px'}, 1000);
}
});
}
Actually, I solved the problem using some street magic (I added a thick white border at the bottom of the menu, and now the "fairy tale" is transparent). But I'm curious what the problem is, and is there a normal solution?
P.S. div . Opera - 9,5 ( , , - ).
P.P.S. Opera 9.6, .