• H5_0028:自定义事件并调用


    1,自定义事件并自己触发事件

       // 定义事件方法
    function MyMousedown( event ) { if ( _this.enabled === false ) return; event.preventDefault(); event.stopPropagation(); if ( _state === STATE.NONE ) { _state = event.button; } if ( _state === STATE.ROTATE && !_this.noRotate ) { // _this.getMouseProjectionOnBall( event.pageX, event.pageY, _rotateStart ); _this.getMouseProjectionOnBall( event.pageX, event.pageY, _rotateStart ); _rotateEnd.copy(_rotateStart) } else if ( _state === STATE.ZOOM && !_this.noZoom ) { _this.getMouseOnScreen( event.pageX, event.pageY, _zoomStart ); _zoomEnd.copy(_zoomStart); } else if ( _state === STATE.PAN && !_this.noPan ) { _this.getMouseOnScreen( event.pageX, event.pageY, _panStart ); _panEnd.copy(_panStart) } window.addEventListener( 'MyMousemove', MyMousemove, false ); window.addEventListener( 'MyMouseup', MyMouseup, false ); _this.dispatchEvent( startEvent ); }

    // 添加事件监听
        window.addEventListener( 'MyMousedown', MyMousedown, false );
     
      
        // 触发事件
        // window.dispatchEvent(new Event('MyMousedown'));




                // 自定义resize事件
                var myEvent = new Event('resize');
                window.dispatchEvent(myEvent);



    琥珀君的博客
  • 相关阅读:
    写在noi之前
    雅礼集训 Day8
    雅礼集训 Day6
    雅礼集训 Day5
    2017雅礼集训 Day4
    2017雅礼集训 Day2
    2017雅礼集训 Day1
    洛谷 P3426 [POI2005]SZA-Template
    Codeforces Round #368 DIV2 C.
    Educational Codeforces Round 16 D&E.
  • 原文地址:https://www.cnblogs.com/eliteboy/p/12411711.html
Copyright © 2020-2023  润新知