How to start mouseover event while dragging

In all presented answers, I don’t see the most simple and obvious one (maybe I’m missing something in OP question). But, if someone stumble upon this later, and needs fast and simple solution in pure JS.. You do it by changing element className ondragover, and changing back to original class ondragleave my_element.ondragover = function(ev) { … Read more

jQuery: trigger a hover event from another element

Try this: $(‘.initiator’).on(‘mouseenter mouseleave’, function(e) { $(‘.receiver’).trigger(e.type); }) It will apply the same triggers for the receiver as the initiator receives for both mouseenter and mouseleave. Note that: .hover(over, out) is just a high-level variant of: .on(‘mouseenter’, over).on(‘mouseleave’, out) so using that information you can be more precise when binding and triggering mouse events. As … Read more

How to tell .hover() to wait?

This will make the second function wait 2 seconds (2000 milliseconds) before executing: $(‘.icon’).hover(function() { clearTimeout($(this).data(‘timeout’)); $(‘li.icon > ul’).slideDown(‘fast’); }, function() { var t = setTimeout(function() { $(‘li.icon > ul’).slideUp(‘fast’); }, 2000); $(this).data(‘timeout’, t); }); It also clears the timeout when the user hovers back in to avoid crazy behavior. This is not a very … Read more

How to display and hide a div with CSS?

To hide an element, use: display: none; visibility: hidden; To show an element, use: display: block; visibility: visible; The difference is: Visibility handles the visibility of the tag, the display handles space it occupies on the page. If you set the visibility and do not change the display, even if the tags are not seen, … Read more

Is there an opposite CSS pseudo-class to :hover?

Yes, use :not(:hover) .child:not(:hover){ opacity: 0.3; } .child { display: inline-block; background: #000; border: 1px solid #fff; width: 50px; height: 50px; transition: 0.4s; } .child:not(:hover) { opacity: 0.3; } <div class=”parent”> <div class=”child”></div> <div class=”child”></div> <div class=”child”></div> <div class=”child”></div> <div class=”child”></div> </div> Another example; I think you want to: “when one is hovered, dim all … Read more

How can I access a hover state in reactjs?

React components expose all the standard Javascript mouse events in their top-level interface. Of course, you can still use :hover in your CSS, and that may be adequate for some of your needs, but for the more advanced behaviors triggered by a hover you’ll need to use the Javascript. So to manage hover interactions, you’ll … Read more

Is it possible to change only the alpha of a rgba background colour on hover?

This is now possible with custom properties: .brown { –rgb: 118, 76, 41; } .green { –rgb: 51, 91, 11; } a { display: block; position: relative; } div { position: absolute; bottom: 0; background-color: rgba(var(–rgb), 0.8); } a:hover div { background-color: rgba(var(–rgb), 1); } To understand how this works, see How do I apply … Read more