简体   繁体   English

在鼠标单击时调用按键事件+ JavaScript

[英]On Mouse Click call Key Event + JavaScript

I wonna to create a Link and if you click on if it call a js script witch calls a Key combination CTRL+/ or CRTL+- 我想创建一个链接,如果您单击它是否调用js脚本,则单击女巫调用组合键CTRL + /或CRTL +-

thx 谢谢

You may want to look here for a similar effect: jQuery: How to catch keydown + mouse click event? 您可能需要在此处查找类似的效果: jQuery:如何捕获keydown +鼠标单击事件?

However, if you are meaning that a user is to press: 但是,如果您要表示用户要按:

Ctrl , / , and click at the same time, that may be more difficult. Ctrl/并同时click ,可能会更加困难。 You also should consider if there is a simpler key combination for you to choose for the user's sake. 您还应该考虑是否有更简单的组合键供您选择以便用户使用。

Edit: 编辑:

I think I may have misunderstood what you are looking for, can you clean up the wording of your question? 我想我可能会误解了您要寻找的内容,您可以整理问题的措辞吗?

I now think that you are meaning to simulate the keypress when a user clicks the link. 我现在认为您的意思是当用户单击链接时模拟按键。 If you are intending to use this to change the "zoom" or the text size on the page (ie: larger / smaller buttons), you should consider using em for text-sizes and then changing the top level font-size with css on the click. 如果您打算使用它来更改页面上的“缩放”或文本大小(即:较大/较小的按钮),则应考虑将em用作文本大小,然后使用css on更改顶级字体大小点击。

This would allow you to provide the same functionality, but isn't a hackish way to get there. 这将使您能够提供相同的功能,但并不是达到此目的的怪诞方式。

Edit 2: 编辑2:

Here's what you're looking for: Simulate Keypress With jQuery 这就是您要寻找的内容: 使用jQuery模拟Keypress

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM