2012-07-26 3 views
0

다음 코드가 IE에서 작동하지 않는 이유를 알고 있습니까? IE에서 근무하는 단어 디스플레이 효과에 의해 단어를 가지고단어 단위로 표시되는 단어 애니메이션이 IE에서 작동하지 않음

  div.hide().contents().each(function() { 
       var words; 
       if (this.nodeType === 3) { 
        words = '<span> ' + this.data.split(/\s+/).join(' </span><span> ') + ' </span>'; 
        $(this).replaceWith(words); 
       } else if (this.nodeType === 1) { 
        this.innerHTML = '<span> ' + this.innerHTML.split(/\s+/).join(' </span><span> ') + ' </span>'; 
       } 
      }); 

      // Remove any empty spans that were added 
      div.find('span').hide().each(function() { 
       if(!$.trim(this.innerHTML)) { 
        $(this).remove(); 
       } 
      }); 

      div.show().find('span').each(function(i) { 
       $(this).css('filter', 'alpha(opacity=40)'); 
       $(this).delay(400 * i).fadeIn(600); 
      }); 

모든 해결 방법을 (다른 브라우저에서 좋은 작업)?

편집 : 바이올린 여기 만든

는 : http://jsfiddle.net/8dh3F/

+1

콘솔에 어떤 오류가 있습니까? 정확히 작동하지 않는 것은 무엇입니까? –

+0

오류 메시지가 표시되지 않습니다. 문제는 텍스트가 전혀 표시되지 않는다는 것입니다. –

+0

fadeTo (600)을 fadeTo (1,600)로 바꾸면 도움이 될 수도 있습니다. – Sem

답변

0

OK :

<div class='intro'> 
    <div class='starthidden intro'>{{ poem.introLine1 }}</div> 
    <div class='starthidden intro'>{{ poem.introLine2 }}</div> 
    <div class='starthidden intro'>{{ poem.introLine3 }}</div> 
    <div class='starthidden intro'>{{ poem.introLine4 }}</div> 
    <div class='starthidden intro'>{{ poem.introLine5 }}</div> 
    <br> 
</div> 
<div class='verse'> 
    <div class='starthidden trait'>{{ poem.traitLine1 }}</div> 
    <div class='starthidden trait'>{{ poem.traitLine2 }}</div> 
    <div class='starthidden trait'>{{ poem.traitLine3 }}</div> 
    <div class='starthidden trait'>{{ poem.traitLine4 }}</div> 
    <div class='starthidden trait'>{{ poem.traitLine5 }}</div> 
    <br> 
</div> 
etc 

JQuery와 :

var div = $('.starthidden'); 
var delay = 400; 
var fadeIn = 600; 
div.lettering(); 
div.find('span').hide(); 
div.show().find('span').each(function(i) { 
    $(this).delay(delay * i).fadeIn(fadeIn); 
}); 
0

문제는이 라인이다. 그것은 IE9에서 작동하지만 그것은 this.innerHTML을 좋아하지 않는 것없는 8 또는 7

this.innerHTML = '<span> ' + this.innerHTML.split(/\s+/).join(' </span><span> ') + ' </span>';

. 고맙게도 jQuery를 사용하고 있습니다!

사용이 대신 :

HTML 마크 업 : 나는 lettering.js 라이브러리를 사용하여, (물론 다른 브라우저에서 작업) IE에서 한 글자를 표시하는 방법을 발견

$(this).html(function(index, oldhtml){ 
    return '<span> ' + oldhtml.split(/\s+/).join(' </span><span> ') + ' </span>'; 
}); 
+0

IE8 또는 IE7에서 작동하도록 관리 했습니까? 방금 IE8을 시도하고 텍스트가 나타나지 않습니다 : jsfiddle.net/Mb8gs –

+0

"메소드 또는 속성 액세스에 예기치 않은 호출"및 코드 "{this.nodeType === 1) && (this.appendChild (a)} "가 강조 표시됩니다. –

관련 문제