오페라는 jQuery의 애니메이션 방법을 매우 이상한 방식으로 처리합니다.

StackOverflow https://stackoverflow.com/questions/846334

  •  21-08-2019
  •  | 
  •  

문제

드롭 다운 메뉴가 있습니다. 높이는 5px에서 130px에서 jQuery로 애니메이션을 제공하며 그 반대도 마찬가지입니다.

메뉴는 분리 된 요소 (내가 개발할 때)가있는 동안 잘 작동했지만 다른 요소가 나타 났을 때 Opera는 놀랍습니다.

Alt Text http://img12.imageshack.us/img12/9366/menusy.png

나는 첫 번째 상태를 1, 2로 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;
}

자바 스크립트 :

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);
     }
  });
}

실제로 나는 약간의 거리 마법을 사용하여 문제를 해결했습니다 (메뉴의 바닥에 두꺼운 흰색 테두리를 추가했으며 이제 "이야기"는 투명합니다). 그러나 나는 문제가 무엇인지 궁금하며 일반적인 해결책이 있습니까?

추신 : 다른 요소는 실제로 고정 된 치수와 배경을 가진 빈 DIV입니다. 내 오페라 버전은 9.5입니다 (나는 그것이 오래되었지만 여전히 내 청중들 사이에서 인기가 있다는 것을 알고 있습니다).

PPS 방금 Opera 9.6에서 테스트했으며 동일한 버그가 발생했습니다.

도움이 되었습니까?

해결책

IE 7, 8 및 FF3에서 코드를 테스트했으며 잘 작동합니다. 그러나 이미 지적했듯이 오페라에서 애니메이션을 실행할 때 실제로 버그가 있습니다. 나는 오페라 9.64에서 그것을 테스트했고 당신과 같은 결과를 얻었습니다.

Google과 오페라 포럼에서 검색 했으며이 특정 버그에 대한 언급을 찾을 수 없었습니다. 내가 찾을 수있는 가장 가까운 것은 다음과 같습니다. jQuery-smooth-scroll-bugs.

이 버그를 오페라로보고하려면 티켓을 만들어야 할 수도 있습니다.

다른 팁

당신은 비어있는 div를 넣을 수 있습니다 <div class="cn bl">, 그리고 높이를 50px (또는 충분한 것)로 설정하고 바닥 마진을 동일하지만 음수 값 (즉 -50px)으로 설정하십시오.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top