• Atitit.js的键盘按键事件捆绑and事件调度


    Atitit.js的键盘按键事件捆绑and事件调度

     

    1. Best的方法还是

     

    objEvtMap[ id+evt ]=function(evt,element)

     

    2. Event bind

     

     

    function bindEvent_4_dataBlock()

    {

    var arr=$("#table1 li");

    arr.each(function(index, element) {

        $(element).keypress(function(){

            alert('keypress');

               });

       var id="data_aid_"+index;

     $(element).attr("id","data_aid_"+index);

    objEvtMap[ id ]=function(evt,element)

    {

    if(evt=="down")

    key_press_hadler($(element));

    if(evt=="up")

    key_press_hadler4up($(element));

     if(evt=="left")

     {};

    if(evt=="rit")

    {}

    };

    });

    }

     

    作者::  ★(attilax)>>>   绰号:老哇的爪子  全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊  汉字名:艾龙,  EMAIL:1466519819@qq.com

    转载请注明来源: http://blog.csdn.net/attilax

     

    3. Event dispatch

    document.onkeydown=function(event){

    var e = event || window.event || arguments.callee.caller.arguments[0];

    alert("keycode:"+e.keyCode);

    if(e && e.keyCode==40 ){//

    //alert('40=下键,39=右键');

    var now=$(".selected");

     var id=$(now).attr("id");

    var func=objEvtMap[id ];

    func("down",now);

    //key_press_hadler(now);

    return false;

    }

  • 相关阅读:
    1-4 Autolayout
    1-3 UIScrollView
    lua 的语法糖
    javascript文档
    cocos2d 图片模糊
    a*寻路分析
    class按传递时分析
    mac 不再接受预览版提示
    OS X 10.11 El Capitan 三指拖动的开启方法
    mac系统卸载mono
  • 原文地址:https://www.cnblogs.com/attilax/p/5963410.html
Copyright © 2020-2023  润新知