【问题标题】:How to turn off document scroll when mouse scrolled - Pure javascript鼠标滚动时如何关闭文档滚动-纯javascript
【发布时间】:2013-11-12 08:55:36
【问题描述】:

我有一个可与鼠标滚动一起使用的 Flash 交互式 swf,

当鼠标悬停在 flash swf / div 包含 flash 时,我试图关闭鼠标滚动。

此外,当鼠标不在 flash swf / 包含 flash 的 div 上时,鼠标滚动应该可以正常工作。

但是鼠标在 swf 上应该可以正常工作。

演示: http://jsfiddle.net/yellowandred/azfMb/

HTML:

<div id="slider">
       <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="1024" HEIGHT="512" id="vtour" ALIGN="">
            <PARAM NAME=movie VALUE="http://localhost/scrollexample/abc.swf">
            <PARAM NAME=quality VALUE=high>
            <PARAM NAME=bgcolor VALUE=#333399>
            <EMBED src="http://localhost/scrollexample/abc.swf" quality=high bgcolor=#333399 NAME="example" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"  WIDTH="1024" HEIGHT="512" ></EMBED> 
       </OBJECT>
<div>

JS:

<script>
document.getElementByID("vtour").addEventListener('mousewheel', 
    function(e){
        e.stopPropagation();
        e.preventDefault();
        e.cancelBubble = false;
        return false;
    }, false);
</script>

【问题讨论】:

    标签: javascript css html flash mousewheel


    【解决方案1】:

    试试这个代码

    document.getElementByID("interactive-container").addEventListener('mousewheel', 
    function(e){
    e.stopPropagation();
    e.preventDefault();
    e.cancelBubble = false;
    return false;
    }, false);
    

    看看这是否有帮助。

    【讨论】:

    【解决方案2】:

    试试这些功能

    $("#interactive-container").bind("mousewheel", function() {
             return false;
         });
    

    您可以参考:Disable mousewheel scroll on swf files?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-19
      • 2020-12-12
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      相关资源
      最近更新 更多