Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在“body”或“p”悬停时创建一个悬停按钮,这意味着它们中的任何一个都会触发悬停事件,你怎么做?
我假设是这样的?
$("body")||$("p").mouseenter(function () {....});
jQuery 选择器像 CSS 选择器一样工作,当你想要多个元素时,你使用逗号:
$("body, p").mouseenter(function () {....});