У меня есть выпадающее меню. Его высота анимирована с помощью jQuery от 5 до 130 пикселей и наоборот.
Меню работало нормально, пока он был отдельным элементом (когда я его разрабатывал), но
когда появились другие элементы, Opera сделала сюрприз:
альтернативный текст http://img12.imageshack.us/img12/9366/menusy.png
Я пометил первое состояние как 1, а второе как 2. Третье состояние должно быть таким же, как первое, но, как вы можете видеть, оно имеет "хвост".
UPD: исходный код
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);
}
});
}
На самом деле я решил проблему с помощью уличной магии (я добавил толстую белую рамку внизу меню, и теперь "сказка" прозрачна). Но мне любопытно, в чем проблема и есть ли нормальное решение?
P.S. Другие элементы - фактически пустые элементы с фиксированными размерами и фоном. Моя версия Opera - 9,5 (я знаю, что она старая, но все еще популярна среди моей аудитории).
P.P.S. Я только что проверил это в Opera 9.6, и произошла та же ошибка.