2009-08-29 7 views
0

イメージを親のDivコンテナの100%の幅にリサイズするスクリプトを書き直すことができました。Swf埋め込みオブジェクトのサイズを変更できるスクリプトを作成しました(Original image resize Script by Oliver私がしたのは、imgタグのパラメータが幅と高さの値を置き換えるすべての行でimgを "embed"に置き換えたものです。JQueryをDIVに100%フィットさせる

Firefoxではすべてが機能していますが、IE 7ではまったく問題ありません。

Here a link to my Project

IE 7がエラーを叫ぶしている間、Firefoxでうまくリサイズフラッシュビデオを見ます。ここで

は私のjqueryのjsの関数である。

(function($) { 
$.fn.imagefit = function(options) { 
    var fit = { 
     all : function(imgs){ 
      imgs.each(function(){ 
       fit.one(this); 
       }) 
      }, 
     one : function(img){ 
      $(img) 
       .width('100%').each(function() 
       { 
        $(this).height(Math.round(
         $(this).attr('startheight')*($(this).width()/$(this).attr('startwidth'))) 
        ); 
       }) 
      } 
    }; 

    this.each(function(){ 
      var container = this; 

      // store list of contained images (excluding those in tables) 
      var imgs = $('img', container).not($("table img")); 

      // store initial dimensions on each image 
      imgs.each(function(){ 
       $(this).attr('startwidth', $(this).width()) 
        .attr('startheight', $(this).height()) 
        .css('max-width', $(this).attr('startwidth')+"px"); 

       fit.one(this); 
      }); 
      // Re-adjust when window width is changed 
      $(window).bind('resize', function(){ 
       fit.all(imgs); 
      }); 
     }); 
    return this; 
}; 

})(jQueryの);

ザ各機能は、私は、トリガ関数から呼び出されるすべてのdivスルー行くに関与している:jQueryの(ドキュメント).ready(関数(){ のjQuery( 'ウィジェットコンテンツ')flashfit(); 。}) ;

私はInternet ExplorerとChromeでも同様に動作させることができますか?何か案は ?

+0

ちょっとそこ私は、[1] [JavaScriptを使用してフルスクリーンにあなたのフラッシュのサイズを変更する方法について]私はここにこの質問に答えを考える[1]:http://stackoverflow.com/questions/7826069/flash -website-bug-with-firefox-and-ie9-but-works-on-ie6/8052217#8052217 –

答えて

1

代わりにswffitを使用することを考えましたか?これは、フルブラウザサイズのFlashファイルだけでなく、コンテナ内でのFlashのサイズ変更にも適しています。

http://swffit.millermedeiros.com/

考慮すべき何か他のものはかなり醜い得ることができ、ステージのサイズや物事に基づいて構成要素の位置を更新するように設定する必要があり、Flashファイルの実際の構造です。

希望に役立ちます。