您好,欢迎来到源码搜藏!分享精神,快乐你我!提示:担心找不到本站?在百度搜索“源码搜藏”,网址永远不丢失!
  • 首 页
  • 在线工具
  • 当前位置:首页 > 网页特效 > jQuery特效 >

    仿iphone软键盘输入文本框

    时间:2014-06-24 19:01 来源:互联网 作者:源码搜藏 浏览:收藏 挑错 推荐 打印

    效果预览 进入下载地址列表

    仿iphone软键盘输入文本框仿iphone软键盘输入文本框是一款基于jQuery+CSS3实现的仿制iphone类型软键盘特效。jQuery软键盘文本框iphone

     //模拟键盘事件,仅支持firefox,ie8-
        
        function simulateKeyEvent(target,keyCode)                         
        {         
            var customEvent = null;
            var a = typeof document.createEvent;


            if(typeof document.createEvent == "function"){//firefox
                try {
                    customEvent = document.createEvent("KeyEvents");
                    customEvent.initKeyEvent("keypress", true, true,window, false, false, false, false, keyCode, keyCode);     
                    target.dispatchEvent(customEvent);
                } catch (ex){
                    //console.log("This example is only demonstrating event simulation in firefox and IE.");        
                }
               


            } else if (document.createEventObject){ //IE
                customEvent = document.createEventObject();
                customEvent.bubbles = true;
                customEvent.cancelable = true;
                customEvent.view = window;
                customEvent.ctrlKey = false;
                customEvent.altKey = false;
                customEvent.shiftKey = false;
                customEvent.metaKey = false;
                customEvent.keyCode = keyCode;
                target.fireEvent("onkeypress", customEvent); 
                       
            } 
            else {
                //console.log("This example is only demonstrating event simulation in firefox and IE.");
            }
        }

    仿iphone软键盘输入文本框由源码搜藏网整理,转载请注明出处http://www.codesocang.com/texiao/jQuerytexiao/9579.html 源码搜藏承诺:本站所有资源无病毒,无弹窗,无干扰链接!