简体   繁体   English

如何在Javascript / Jquery中以编程方式调用突出显示效果(类似于鼠标悬停)?

[英]How do you invoke the highlight affect (similar to mouse over) progmatically in Javascript/Jquery?

I am writing an interface where there will be a list of wide buttons, I want to be able to highlight a button based on a mouse being moved up or down. 我正在编写一个界面,其中将有一个宽按钮列表,我希望能够根据鼠标向上或向下移动来突出显示一个按钮。 Selecting the button below the current highlighted button when the mouse moves down and selects the button above when the mouse moves up. 当鼠标向下移动时,选择当前突出显示的按钮下方的按钮,而当鼠标向上移动时,选择上方的按钮。

I was about to write a load of CSS manipulating Jquery code to do this, but something about doing that does not feel right. 我本打算编写大量CSS操作Jquery代码来执行此操作,但是这样做的感觉并不正确。

Any suggestions welcome (including thats the way to do it fool) 欢迎任何建议(包括多数民众赞成在愚蠢的方式)

Use CSS to highlight your button 使用CSS突出显示您的按钮

Example: 例:

button{color: green}
button:hover{color: red}

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

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