3

I have PIE on my site so that IE can do border-radius, drop-shadow, etc. All was well until I decided to make the site load a little quicker by converting the common background images into a sprite and positioning them with CSS. This works fine until you zoom in in IE. Whilst the div, border-radius and drop shadow resize nicely, the background image doesn't scale and ends up showing the other sprite images.

Does anyone know how to sort out PIE (either by css or messing with the behaviour) so that it behaves nicely in IE when a user changes the page zoom?

4

1 に答える 1

3

理想的ではありませんが、javascript を使用してすべての要素から動作属性を削除することに頼っています。

<!--[if ie]>
<script type="text/javascript">
function removeBehavior()
{
  if((screen.deviceXDPI / screen.logicalXDPI) != '1')
  {
    $("*").each(function(){
      $(this).css("behavior", "none");
    });
  }
}
removeBehavior();
window.onresize = removeBehavior;
</script>
<[endif]-->

この関数は IE でのみ実行されます。画面サイズをチェックします。1 でない場合 (100% に等しい)、(jQuery を使用して) dom 全体を調べて、動作属性を削除します (または、少なくとも空の値として設定します)。

次に、最初のページ呼び出しで関数を呼び出し、ユーザーがページの表示中にズームを変更した場合に備えて、onresize イベントに追加します。

理想的ではありませんが、機能します。

于 2011-03-09T10:32:48.233 に答える