Is there any way to hover over an element that's already hidden. I am trying to mimic what Steam does with their arrow navigation on their home page. You'll notice that when you first get to the page, there are no arrows showing:
Then when you hover over the area where there should be an arrow, it shows itself:
I've tried setting my divs that contain the arrow images to display: none
and have also tried visibility: hidden
but neither seems to work with the hover or mouseover methods in jQuery. I would have thought visibility: hidden
would make it work, but that doesn't seem to be the case. Is there any other way I can hide these divs from the start but still be able to have hover events work on them?
To display the element on hover, make them invisible by default using display: none property. Then add :hover property on that element with display: block to make it visible on hover.
Style display property is used to hide and show the content of HTML DOM by accessing the DOM element using JavaScript/jQuery. To hide an element, set the style display property to “none”. document.
You can hide an element in CSS using the CSS properties display: none or visibility: hidden. display: none removes the entire element from the page and mat affect the layout of the page. visibility: hidden hides the element while keeping the space the same.
Set it to zero opacity instead:
$('#blah').hover(function() { $(this).fadeTo(1,1); },function() { $(this).fadeTo(1,0); });
http://jsfiddle.net/mblase75/bzaax/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With