且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jQuery for IE7和IE8在Facebox中加载FLV

更新时间:2023-12-05 10:49:16

此代码将在实例化facebox javascript后成功加载JWplayer。在IE7或IE8中没有显示视频仍然有些麻烦,但JWplayer加载得恰到好处。

This code will successfully load JWplayer after the facebox javascript is instantiated. There is still something screwy going on with video not displaying in IE7 or IE8, but JWplayer loads appropriately.

HTML:

<a class="flash" href="http://hometownquarterlyvideos.s3.amazonaws.com/whatishqchannel.flv" rel="/flash/video_girl/whatishqchannel.jpg">Flash</a>

Javascript:

Javascript:

$(document).ready(function(){
 // click on flash video link
 $('.flash').click(function(){
  $.facebox('<div id="fbvideo"></div>');
  var so = new SWFObject('/flash/playerTrans.swf','fbvideo','640px','360px','0');
  so.addParam('allowscriptaccess','always');
  so.addParam('allowfullscreen','true');
  so.addParam('wmode','transparent');
  so.addVariable('file', $(this).attr('href'));
  so.addVariable('autostart','true');
  so.addVariable('controlbar','none');
  so.addVariable('repeat','always');
  so.addVariable('image',$(this).attr('rel'));
  so.addVariable('icons','false')
  so.addVariable('screencolor','none');
  so.addVariable('backcolor','FFFFFF');
  so.addVariable('screenalpha','0');
  so.addVariable('overstretch', 'true');
  so.write('fbvideo');
  return false;
 })
})