开发者

<div> appears under cursor in textArea when I press ctrlKey?

I have the textBox(textArea) when I type something in i开发者_Python百科t an then press ctrlKey I need some little 'div' appears under cursor. How can I manage that??


Hi I think those things can help you:

$('#yourTextAreaID').keypress(function(e) {
   // 17 is the keyCode for crtl
   if(e.keyCode == 17) {
     $(document).mousemove(function(e){
       $('#yourDiv').postion(e.pageX, e.pageY).show;
      }); 
   }

});

First It checks if the crtl key was pressed bey de keypress event trigger on your text area. Then it gets the current mouse postion on the screen, then its sets your div to the postion of the mouse

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜