简体   繁体   English

悬停在另一个元素上时,使一个元素出现并进行调整

[英]Make an element appear and make adjustments when hovering over another element

I'm having problems with my code. 我的代码有问题。 I have it set up properly to show a hidden div mejs__horizontal-volume-slider when you hover over mejs__volume-button and shift other elements to the right to accommodate mejs__horizontal-volume-slider . 我有它正确设置以显示隐藏的div mejs__horizontal-volume-slider ,当你将鼠标悬停在mejs__volume-button等元素向右移,以适应mejs__horizontal-volume-slider The problem I have is that mejs__horizontal-volume-slider disappears when you move off mejs__volume-button . 我的问题是,当您离开mejs__volume-button时, mejs__horizontal-volume-slider消失了。

I'm looking for a way to show mejs__horizontal-volume-slider and adjust the volume when you hover over mejs__volume-button and move over to mejs__horizontal-volume-slider . 当您将鼠标悬停在mejs__volume-button并移至mejs__horizontal-volume-slider时,我正在寻找一种显示mejs__horizontal-volume-slider并调整mejs__horizontal-volume-slider

URL: http://wpfreelance.bayoumedia.net/audio/ 网址: http//wpfreelance.bayoumedia.net/audio/

JS code: JS代码:

  $(document).ready(function() {
$('.mejs__volume-button').hover(
function () {
 $('.mejs__horizontal-volume-slider').css({"display":"block"});
 $('.mejs__time-slider').css({"width":"-moz-calc(100% - 50px)"});
 $('.mejs__time-slider').css({"width":"-webkit-calc(100% - 50px)"});
 $('.mejs__time-slider').css({"width":"calc(100% - 50px)"});
 $('.mejs__speed-button').css({"right":"40px"});
},
function () {
 $('.mejs__horizontal-volume-slider').css({"display":"none"});
 $('.mejs__time-slider').css({"width":"100%"});
 $('.mejs__speed-button').css({"right":"0"});
});});

Insert the slider and the button in the same container, and trigger the hover effect with the container, so when you're moving over the slider, you're still hovering the container. 将滑块和按钮插入同一容器中,并使用该容器触发悬停效果,因此,当您在滑块上移动时,仍将鼠标悬停在该容器上。 It's probably better to use CSS by the way. 顺便说一句,使用CSS可能更好。

暂无
暂无

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

相关问题 元素A放置在元素B上。无论如何,当将鼠标悬停在元素A上时,使页面看起来元素B仍在悬停吗? - Element A is positioned over Element B. Anyway, when hovering over Element A, make the page appear that Element B is still being hovered over? 悬停在元素上时使功能停止 - Make function stop when hovering over an element 如何在将鼠标悬停在另一个元素上时显示一个元素,如果没有则隐藏它。 让它一直占据空间 - How can I make a element show when hovering over another element, and hide it if not. And make it take up space the entire time 悬停在元素上时使图像跟随光标 - Make image follow cursor when hovering over an element jQuery:将鼠标悬停在某个元素上会导致另一个元素的淡入淡出,但是将鼠标悬停在该元素上时它会消失 - jQuery: Hovering over an element brings fades in another element, but when hovering over that element it disappears 悬停在一个div上时如何显示更多div? - How to make more divs appear when hovering over one div? jQuery-悬停在另一个元素上时触发悬停 - jquery - trigger hover on one element when hovering over another 悬停在另一个元素上时如何触发悬停 - How to trigger hover when hovering over another element D3.js悬停在另一个元素上时突出显示一个元素 - D3.js Highlight an element when hovering over another 悬停在另一个元素上时保持Li的悬停状态 - Keeping the Hover State of a Li When Hovering Over Another Element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM