嵌入式Flash对象上的HTML包装器不能是“可点击的”由jQuery [英] HTML wrapper div over embedded flash object cannot be "clickable" by jQuery

查看:188
本文介绍了嵌入式Flash对象上的HTML包装器不能是“可点击的”由jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我一直试图按照客户的要求去做:当客户点击swf格式的顶部横幅时,重定向到活动页面,然后到达目的页面。你可以检查: http://ausdcf.org



如果您使用Firefox,Chrome或Safari,我怀疑您可以到达目标页面。

然而,如果您使用的是IE或Opera,怀疑它。



我认为导致这样一个奇怪的问题是:
$ b

swf ojbects没有链接到URL,所以我必须像这样破解主题模板文件:

>

 < div id =header>'; 
$ b $ *
*一个快速和肮脏的方式把一些瑞士法郎到PHP,并旋转其中...
* /

//可用横幅
$ banners =数组(
'http://localhost/smf/flash/banner_fertalign_1.swf',
'http://localhost/smf/flash/banner_fertalign_2.swf' ,
'http://localhost/smf/flash/banner_fertalign_3.swf'
);

//获得随机横幅
srand((double)microtime()* 1000000);
$ rand = rand(0,count($ banners)-1);

echo'< div id =top_banner_clickable>';
echo'< div id =top_banner_wrapper>';
echo'< object width =400height =60>';
echo'< param name =wmodevalue =transparent>';
echo'< embed wmode =transparentsrc ='。$ banners [$ rand]。'';
echo'width =400height =60type =application / x-shockwave-flash';
echo'pluginspage =http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash/>';
echo'< / object>';
echo'< / div>';
echo'< / div>';

和相关的jQuery代码是这样的:

  / * master.js * / 

$(document).ready(function()
{
$( click(function()
{
window.location =http://ausdcf.org/campaign/;
});
});

我完全不了解Flash或嵌入式对象。我想这是造成这个问题的原因。另外,我不知道为什么它可以与一些浏览器,但不是所有的...



我甚至试图添加一个z-index的包装div在CSS这:

  #top_banner_clickable 
{
z-index:100;



$ b $ p
$ b

不会这样做,或者...



有没有办法解决这个问题?

更新:



我试图说服客户现在使用Google AdSense来做这件事...

非常感谢。

解决方案

您无法使用javascript捕捉Flash对象顶部的单击事件。您可以在这里找到 这里

你可以建议你的客户端应该修改Flash的源代码来处理点击。如果这是不可能的,那么使用容器Flash对象来托管横幅。


I've been trying to do as the client requested : redirect to campaign page then to destination page once a customer clicks on the top banner in swf format.

You can check what's been done at :http://ausdcf.org

If you are using Firefox, Chrome or Safari, I suspect you can reach the destination page.

However, if you are using IE or Opera, I doubt it.

I think to cause of such a weird problem is:

The swf ojbects don't have a link to url, SO

I have to hack the theme template file like this :

<div id="header">';

/*
     * A quick and dirty way to put some swf into PHP, and rotate among them ...
     */ 

    //available banners
    $banners = array(
                         'http://localhost/smf/flash/banner_fertalign_1.swf',
                         'http://localhost/smf/flash/banner_fertalign_2.swf',
                         'http://localhost/smf/flash/banner_fertalign_3.swf'
                    );

    //get random banner
    srand((double) microtime() * 1000000);
    $rand = rand(0,count($banners)-1);

    echo '<div id="top_banner_clickable">';
    echo     '<div id="top_banner_wrapper">';
    echo         '<object width="400" height="60">';
    echo             '<param name="wmode" value="transparent">';
    echo             '<embed wmode="transparent" src="'.$banners[$rand].'" ';
    echo             'width="400" height="60" type="application/x-shockwave-flash"';
    echo             'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" />';
    echo         '</object>';
    echo     '</div>';
    echo '</div>';

And the related jQuery code is like this:

/* master.js */

$(document).ready(function()
{
    $("#top_banner_clickable").click(function()
    {
        window.location ="http://ausdcf.org/campaign/";
    });
});

I absolutely know nothing about Flash or embedded objects. I guess that's the cause of this problem. Plus, I don't know why it works with some browsers but not all...

I even tried to add a z-index to the wrapper div in css like this:

#top_banner_clickable
{
    z-index : 100;
}

No this wouldn't do, either...

Is there a way to go around this issue?

Update :

I am trying to convince the client to use Google AdSense for this sort of thing now...

Many thanks in advance.

解决方案

You can't use javascript to catch click events on top of a flash object. You can find similar questions here and here.

You could suggest to your client that the source code of the flash should be modified to handle the clicks. If this is not possible, then use a container flash object to host the banners.

这篇关于嵌入式Flash对象上的HTML包装器不能是“可点击的”由jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆