2011-09-21 125 views
0

我已經構建了this website嚴重依賴JQuery,並且遇到了與IE有關的問題。JQuery + IE問題

當你點擊該圖標:

enter image description here

有這麼下來並加載一個iframe持有形式的自定義燈箱。它的工作原理在Chrome/FF罰款,但在IE它說有一個錯誤:

enter image description here

我特意使用的JQuery的非精縮版摸出這是有問題的代碼行,這似乎是:

fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; 

此外,這是我寫創建燈箱效果:

function popup(url, width, height) 
{ 
    var shell = $('<div id="popup-shell"></div>'); 
    shell.append('<div style="margin-top: -' + height + 'px; width: ' + width + 'px; height: ' + height + 'px;" id="popup-inner"></div>'); 

    var inner = shell.find("div#popup-inner"); 

    var cb = $('<a style="margin-left: ' + Number(width - 26) + 'px;" id="popup-close"></a>'); 

    inner.append(cb); 
    inner.append('<iframe width="' + width + '" height="' + height + '" src="' + url + '" scrolling="no" frameborder="0"></iframe>'); 

    cb.click(function() 
    { 
     shell.stop().animate({height: "0%"}, 700, 0, function() 
     { 
      shell.remove(); 
     }); 
    }); 

    shell.animate({height: "100%"}, 700, 0, function() 
    { 
     inner.animate({marginTop: "120px"}, 700); 
    }); 

    $("body").append(shell); 
} 

如果這是一個已知的問題,任何建議或解決方案會很好。

回答

1

追加Shell對象身先

$("body").append(shell); 

然後添加腳本動畫

shell.animate({height: "100%"}, 700, 0, function() 
    { 
     inner.animate({marginTop: "120px"}, 700); 
    }); 

這應該解決您的問題。我測試了它在IE控制檯模式下,它工作

+0

真棒,謝謝堆! – Marty