zoukankan      html  css  js  c++  java
  • Mootools遮罩层练习(原为网上的jquery写法)

    <html >

    <head>

    <meta charset="utf-8" />

    <title>mootools 遮罩层</title>

    <meta name="author" content="whellote" />

    <style>

    #pageOverlay { visibility:hidden; position:fixed; top:0; left:0; z-index:1987; 100%; height:100%; background:#000; filter:alpha(opacity=70); opacity:0.7; }

     

    </style>

    <script src="http://cdn.bootcss.com/mootools/1.5.1/mootools-core-full-compat.js"></script>

    </head>

    <body>

    <div id="pageOverlay"></div>

    <button id="open_ajax">模拟ajax触发</button>

    <script>

     

    var getPage = function(){

    var dd = document.documentElement,

    db = document.body;

    return {

    left: Math.max(dd.scrollLeft, db.scrollLeft),

    top: Math.max(dd.scrollTop, db.scrollTop)

    };

    };

     

     

    /*

    var keyValidate = function(e){

    key = e.code;

    if((key == 116) || (e.ctrlKey && key == 82) || (e.ctrlKey && key == 65) || (key == 9) || (key == 38) || (key == 40)) {

    return true;

    }

    }

    */

     

    var lock = {

    eventReturn : function(e){

    return false;

    },

     

    mouseEventArray : [

    'DOMMouseScroll',

    'mousewheel',

    'scroll',

    'contextmenu',

    ],

    keyEventArray : [

    'keyup',

    'keydown',

    'keypress',

    ],

    doAddEvent : function(eventArr){

    var eventType = eventArr;

    for(var i = 0; i < eventType.length; i++){

    document.addEvent(eventType[i],this.eventReturn);

    }

    },

    doRemoveEvent : function(eventArr){

    var eventType = eventArr;

    for(var i = 0; i < eventType.length; i++){

    document.removeEvent(eventType[i],this.eventReturn);

    }

    },

    open : function(){

    $('pageOverlay').style.visibility = 'visible';

    this.doAddEvent(this.mouseEventArray);

    this.doAddEvent(this.keyEventArray);

    },

    close : function(){

    $('pageOverlay').style.visibility = 'hidden';

    this.doRemoveEvent(this.mouseEventArray);

    this.doRemoveEvent(this.keyEventArray);

    }

     

    };

     

    $('open_ajax').addEvent('click', function(e){

    lock.open();

    });

    $('pageOverlay').addEvent('click', function(e){

    lock.close();

    });

     

     

    </script>

    </body>

    </html>

  • 相关阅读:
    idea git使用记录
    会计科目中的借贷理解
    git使用合集
    Unsupported major.minor version 52.0
    sts问题合集
    idea导入工程
    (转)解决mybatis的mapper.xml查询不出数据,结果一直为null问题
    战争热诚的python全栈开发之路
    Python机器学习笔记:SVM(4)——sklearn实现
    Python机器学习笔记:SVM(3)——证明SVM
  • 原文地址:https://www.cnblogs.com/helkbore/p/5209115.html
Copyright © 2011-2022 走看看