Atitit. Get up and down left right neighbor's method soft keyboard design:

Source: Internet
Author: User

Atitit. get up down left right neighbor's method design of soft keyboard ..

Left right can use the next prev directly.

Up-down can be judged using the pix ... Get Next Element of the position ... Compare Top

However , if the cross- block ... just all that can be used Positon solution. ...

Judging is not next block ... can use span 10px; .... because Block size is not as large .. Belle can use the centerline, too. ..

if (left_cur+10 >focusobj_left && left_cur-10<focusobj_left && top_cur>focusobj_top)

Author :: ★ (Attilax) >>>    nickname : old-Wow paw &NBSP; ( &NBSP; full name:: ATTILAX&NBSP;AKBAR&NBSP;AL&NBSP;RAPANUI&NBSP, Attilax &NBSP, " "  Al &NBSP; Rapa Nui &NBSP, &NBSP; Kanji name: Ayron, Email:[email protected]

reprint Please indicate source: http://www.cnblogs.com/attilax/

JavaScript Document

function SearchBox ()

{

}

Searchbox.prototype.removefocus=function ()

{

var arr=$ (". SearchBox. Key");

Arr.each (function (index, Element) {

$ (Element). Removeclass ("hover");

});

var now=$ (". Hover"). Get (0);

}

Searchbox.prototype.getfocuscontrol=function ()

{

var now=$ (". Hover"). Get (0);

return now;

}

Searchbox.prototype.key_up_event=function (Curfocusobj)

{

}

Searchbox.prototype.key_down_event=function (Curfocusobj)

{

var focusobj_top = $ (curfocusobj). Offset (). Top;

var focusobj_left = $ (curfocusobj). Offset (). Left;

Alert ("cur xy:" +focusobj_left+ "" +focusobj_top);

var Isfind=false;

var arr=$ (". SearchBox. Key");

Arr.each (function (index, Element) {

if (element). html () = = "J")

Alert ("--");

if (Element). attr ("id")!=$ (curfocusobj). attr ("id"))

$ (Element). Removeclass ("hover");

if (Element). attr ("id") ==$ (curfocusobj). attr ("id"))

return true; Continue

var top_cur= $ (Element). Offset (). Top;

var left_cur= $ (Element). Offset (). Left;

if (left_cur+10 >focusobj_left && left_cur-10<focusobj_left && top_cur>focusobj_top)

{

$ (Element). addclass ("hover");

Isfind=true;

return false; Break

}

});

if (Isfind)

$ (curfocusobj). Removeclass ("hover");

}

Searchbox.prototype.key_left_event=function (Curfocusobj)

{

}

Searchbox.prototype.key_rit_event=function (Curfocusobj)

{

}

Searchbox.prototype.key_enter_event=function (Curfocusobj)

{

var value = curfocusobj.html ();

$ ('. SearchBox. TextBox '). Append (value);

}

Searchbox.prototype.bindkeyevent=function ()

{

var arr=$ (". SearchBox. Key");

Arr.each (function (index, Element) {

var id= "Key_aid_" +INDEX;

$ (Element). attr ("id", id);

//

// objevtmap[id+ "--left"]=function (Element)

//  {

//  

//  

//  }

objevtmap[id+ "--enter"]=function (Element)

{

This.key_enter_event ($ (element));

}

objevtmap[ID]=function (evt,element)

{

if (evt== "down")

This.key_down_event ($ (element));

if (evt== "up")

This.key_up_event ($ (element));

if (evt== "left")

 {

This.key_left_event ($ (element));

};

if (evt== "RIT")

{

This.key_rit_event ($ (element));

}

};

});

}

Atitit. Get up and down left right neighbor's method soft keyboard design:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.