HTML wrapper div over embedded flash object cannot be “clickable” by jQuery

后端 未结 2 2000
野的像风
野的像风 2021-01-26 17:52

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

相关标签:
2条回答
  • 2021-01-26 18:12

    I think the problem is that Flash is swallowing the click event and preventing from bubbling up through the rest of the document. Or Flash is interfering with jQuery's solution for inconsistent models for event propagation. So I think the thing to do is to add a div that floats above the flash movie, but is a sibling (of the movie or one of its parents). Something like this:

    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 id="clickableoverlay"></div>'; // float this div above the movie
    echo     '</div>';
    echo '</div>';
    

    Use CSS to make #clickableoverlay lie on top of the movie and apply your click() to that. I don't think you should need to use z-index here if the <div> appears after the <object>. Be careful to use wmode="transparent" (which you are!) or wmode="opaque". If you use wmode="window", the flash movie will always be on top of everything else, no matter what CSS you try to give it.

    0 讨论(0)
  • 2021-01-26 18:25

    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.

    0 讨论(0)
提交回复
热议问题