2010-03-04 8 views
0

이 하나의 문제가 발생했습니다. 요소에 HTML을 추가 한 다음 페이드 인하려고합니다. 그러나 구현되면 페이드 인하지 않습니다. 즉시 스냅됩니다. 구문/순서가 올바르게 보입니다. 누구나 내 논리 아무 잘못을 참조하십시오jQuery fadeIn() 페이드 인하지 않음

$('span.mySpan') 
    // fade out the empty span so it's hidden 
    .fadeOut('fast',function(){ 
     $(this) 
      .html($restoreLink) // add the HTML to the hidden span 
      .fadeIn('slow') // now fade it in 
    }) 

답변

0

은 당신이 fadeIn 라인의 끝에와 함수의 끝에 세미콜론이 필요하십니까? ->;

$('span.mySpan') 
    // fade out the empty span so it's hidden 
    .fadeOut('fast',function(){ 
     $(this) 
      .html($restoreLink) // add the HTML to the hidden span 
      .fadeIn('slow'); // added ; 
    }); // added ; 
+0

아니요; 그렇지 않으면 전혀 나타나지 않습니다. – SLaks

+0

아 ... 이것은 사실입니다. –

0

Internet Explorer 8을 사용하고 있습니까? Internet Explorer 8에서 JQuery로 불투명도 조작을하면 제대로 작동하지 않는다고 생각합니다. 그것은 여기 작동합니까

+0

모든 브라우저 (IE, Firefox, Chrome, Safari)에서 일관성이 있습니다. –

+0

내가 알아챈 한 가지는 적어도 IE8의 경우 특정 DOCTYPE 및 주로 Quirks 모드로 강제 실행되는 IE8에서만 작동한다는 것입니다. – dbrien

2

내가 무엇을 사용 : 그것은 정말 빠른 페이드

<html> 
<head> 
<script type="text/javascript" src="jquery.js"></script> 
<script> 
     $(document).ready(function() { 
       $('span.mySpan') 
    // fade out the empty span so it's hidden 
    .fadeOut('fast',function(){ 
     $(this) 
      .html('<strong>testing</strong>') // add the HTML to the hidden span 
      .fadeIn(2000) // now fade it in 
    }) 

     }); 
</script> 
</head> 
<body> 
<span class="mySpan">Hello</span> 

</body> 
</html> 

. 타이머가 5000 밀리 초라고 말하면 내 뜻을 알 수 있습니다.

+0

글쎄, 내가 뭘했는지 모르지만 지금은 효과가있다. ARGH! 어쨌든, 당신은 저를 테스트하기 위해 주변을 움직일 생각을하고 어떻게 든 그것을 고치는 것입니다. –