简体   繁体   English

当我将鼠标放在按钮上时,如何检测按钮的颜色是否因为 CSS 或 JavaScript 事件而改变?

[英]How can I detect if the color of a button changes because CSS or JavaScript event when I put mouse on button?

How can I detect if color of bottom change because CSS or JavaScript event when I put mouse on button?当我将鼠标放在按钮上时,如何检测底部颜色是否因 CSS 或 JavaScript 事件而改变?

My solution that not good enough:我的解决方案不够好:

  1. create function that will listen to JavaScript events创建将监听 JavaScript 事件的函数
  2. check with firebug if element have CSS 'hover' rule使用萤火虫检查元素是否有 CSS 'hover' 规则

Problems in my solution:我的解决方案中的问题:

  1. Can't detect which event happen before CSS or JavaScript无法检测在 CSS 或 JavaScript 之前发生的事件

  2. Not Auto check不自动检查

Please give better solution if you have.如果有,请提供更好的解决方案。 (I working with jQuery) (我使用 jQuery)

You can check with Firebug which events are fired in JavaScript.您可以使用 Firebug 检查 JavaScript 中触发了哪些事件。 Go to the Console and click "Profile".转到控制台并单击“配置文件”。 Then move your mouse over the button and you will see the JavaScript event show up.然后将鼠标移到按钮上,您将看到 JavaScript 事件出现。

暂无
暂无

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

相关问题 仅当鼠标悬停在颜色上时,如何显示按钮? - How can I show the button only when the mouse hovers on the color? 如何在JavaScript中检测鼠标右键释放事件? - How to detect right mouse button release event in javascript? 当我使用鼠标 hover 使用 CSS 时,我试图让按钮中的文本更改颜色 - I am trying to make the text in a button change color when I hover over in with the mouse using CSS 如何在鼠标按下时检测鼠标右键事件? - How can I detect a rightmouse button event on mousedown? 如何使用 ReactJS 检测鼠标滚动按钮向下事件? - How do I detect the mouse scroll button down event using ReactJS? 如何在HTML5,JavaScript,CSS,Sass中实现随机按钮颜色生成器 - How can I implement random button color generator in Html5, JavaScript, Css, Sass 如何检测变量何时更改JavaScript中的值? - How can I detect when a variable changes value in JavaScript? Javascript,只有在我点击一个按钮后才能在鼠标悬停时更改链接颜色 - Javascript, change a link color when mouse is over it, only after I click a button 我需要使用 HTML、CSS 和 Javascript 制作一个按钮,以便在单击按钮时将字体颜色从红色变为红色 - I need to make a button using HTML, CSS, and Javascript to change font color from to red when the button is clicked 使用CSS3或JavaScript单击时,如何“突出显示”此CSS按钮? - How can I “highlight” this CSS button when is clicked using CSS3 or JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM