次のコードが 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);
});
単語ごとの表示効果を IE で動作させるための回避策はありますか?
編集:
ここにフィドルを作成しました:http://jsfiddle.net/8dh3F/