Javascript Windows Firefox中类似Facebook的按钮存在问题
我有一个类似facebook的按钮(iFrame版),它覆盖在一个全浏览器Flash应用程序之上。like按钮连接到应用程序中类似的单独图像,当显示每个新图像时,like按钮使用ExternalInterface刷新数据 like按钮使用JQuery fadeIn()/fadeOut()为每个新图像淡入淡出,再次使用ExternalInterface调用 我遇到的问题是,在Windows上,这似乎不想工作,特别是在Firefox中 CSS: fb like是包含iFrame的div,它的z索引是9999,以确保它始终位于顶部 下面是正在使用的JS:Javascript Windows Firefox中类似Facebook的按钮存在问题,javascript,windows,firefox,facebook,facebook-like,Javascript,Windows,Firefox,Facebook,Facebook Like,我有一个类似facebook的按钮(iFrame版),它覆盖在一个全浏览器Flash应用程序之上。like按钮连接到应用程序中类似的单独图像,当显示每个新图像时,like按钮使用ExternalInterface刷新数据 like按钮使用JQuery fadeIn()/fadeOut()为每个新图像淡入淡出,再次使用ExternalInterface调用 我遇到的问题是,在Windows上,这似乎不想工作,特别是在Firefox中 CSS: fb like是包含iFrame的div,它的z索引是
<script type="text/javascript">
var isVisible = false;
function showLikeButton( visible ){
if( visible == true )
{
$('#fb-like').fadeIn( 'slow' );
isVisible = true;
}
else if ( isVisible )
{
$('#fb-like').fadeOut( 'slow' );
isVisible = false;
}
}
var begOfUrl = "http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmywebsite.com%2fdirectory";
var endOfUrl = "&layout=button_count&show_faces=false&width=150&action=like&colorscheme=dark&height=21";
function sendIdToLikeButton( title, id ){
$( '#facebook-like' ).attr( 'src', begOfUrl + "%3Fid=" + id + endOfUrl );
}
</script>
var isVisible=false;
函数showLikeButton(可见){
如果(可见==真)
{
$('fb like').fadeIn('slow');
isVisible=true;
}
else if(可见)
{
$('fb like')。淡出('slow');
isVisible=false;
}
}
变量begofull=”http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmywebsite.com%2fdirectory";
var endofur=“&;布局=按钮\计数和显示\面=假和宽度=150&;操作=相似和颜色方案=深色和高度=21”;
函数sendIdToLikeButton(title,id){
$('#类似facebook').attr('src',begOfUrl+%3Fid=“+id+endofur”);
}
其中,sendIdToLikeButton方法使用ExternalInterface获取从Flash发送的照片的id,以重新创建iFrame的src属性
当然,由于这是一个flash应用程序,下面是最简单的HTML:
<body>
<div id="fb-like">
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fnfb.designaxiom.com/build13&layout=button_count&show_faces=false&width=150&action=like&colorscheme=dark&height=21" scrolling="no" frameborder="0" style="position: absolute; border:none; overflow:hidden; width:300px; height:40px;" allowTransparency="true" id="facebook-like"></iframe>
</div>
<div id="flashContent">
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
</div>
</body>
再说一次,除了Windows中的Firefox,这在任何地方都有效,我不知道该怎么办。我假设这是CSS或Javascript中的错误
非常感谢您的帮助
提前谢谢
语法经过几周的反复思考,我终于明白了这一点。事实证明,问题在于iframe被放置在flash内容的顶部 通过向swfobject调用添加一个参数——将wmode设置为透明,可以解决此问题:
var params = {};
params.bgcolor = "#000000";
params.allowfullscreen = "true";
params.allowscriptaccess = "true";
params.wmode = "transparent";
var attributes = { id: "nfb", name:"nfb" };
var swfUrl = "Runner.swf";
swfobject.embedSWF( swfUrl, "flashContent", "100%", "100%", "10.0.0", false, flashvars, params, attributes );
将wmode设置为transparent允许在每个浏览器中将“transparent”iframe放置在应用程序的顶部
所以,事实证明,这根本不是facebook按钮的问题,而是iFrame和Flash的问题。当然,如果您没有使用SWFObject来显示swf文件,则可以在发布swf时在Flash的“发布属性”中设置wmode参数
干杯
var params = {};
params.bgcolor = "#000000";
params.allowfullscreen = "true";
params.allowscriptaccess = "true";
params.wmode = "transparent";
var attributes = { id: "nfb", name:"nfb" };
var swfUrl = "Runner.swf";
swfobject.embedSWF( swfUrl, "flashContent", "100%", "100%", "10.0.0", false, flashvars, params, attributes );