div that appears on hover blocks hover state hit area - html

I have a div that I want to appear when hovering over a certain area on an image. The hover effect works fine and the div appears when the hit area is hovered over, but there are two problems I am encountering.
The div that appears needs to be in a specific position overlaying the background image, but this means that it blocks part of the hit area. The portion of the hit area that is blocked by the appearing div no longer triggers the hover effect because of this, even when it is not visible. There is no way to reposition or resize the appearing div so the hit area is unblocked because they need to correspond to specific areas. How can I make sure the entire hit area triggers the hover effect while maintaining the position of the appearing div?
The div that appears holds a call to action button that users need to be able to click on once they see the div appear. However, the appearing div disappears when the user moves to click on the button. Is there a way that I can make the div remain visible long enough so the user can click the button?
I would like to accomplish this using CSS, but if JS is necessary, that's cool.
I created this fiddle as a rough idea of what the problem is. As you can see, all three of the red boxes should trigger the hover effect, but only the last one actually does because the div that appears on hover blocks them. The button would appear within the blue box, but the box disappears as soon as the mouse leaves the hit area.
I'm using opacity to show and hide the div because our site has transitions that would allow this to fade in and out. The code is simplified and stripped down, but illustrates the idea.
HTML:
<a class="hover-grid hit-area">
</a>
<a class="hover-grid hit-area">
</a>
<a class="hover-grid hit-area">
</a>
<div class="details">
</div>
CSS:
.hover-grid
{
background-color: red;
opacity: 0.25;
width:100px;
height:100px;
display: block;
float:left;
}
.details
{
opacity: 0;
background-color:blue;
width:200px;
height:150px;
position: relative;
z-index: 2;
}
.hit-area:hover ~ .details
{
opacity:1;
}

Just apply the hover effect to .detail as well. And instead of opacity use display:none, to not trigger the hover state on the invisible element.
http://jsfiddle.net/me2loveit2/3shj2omg/3/
.details
{
display:none;
background-color:blue;
width:200px;
height:150px;
position: relative;
z-index: 2;
}
.hit-area:hover ~ .details
{
display:block;
}
.details:hover
{
display:block;
}

Related

Creating a on hover effect where the effect stays forever

I can't seem to recollect how to do this CSS only trick where one can hover over an element and the effect of the hover stays forever. I know it had something to do with transition being set to 9999s meaning it will take forever to return back to normal, hence the end result stays. This is good for making css only dialog boxes to stay open.
Using the following HTML and CSS elements:
<div>
something here
</div>
CSS:
div { width: 100px: height: 100px; transition: all 9999s; }
div:hover { height: 300px }

Modify CSS after hover effect on mobile

I am working on a website where one of the sessions has a click effect. Basically the text body is hidden and when clicking on it expands showing the hidden text as you can see in the image:
Before Click
After Click
In CSS, basically the text element has a height of 30px and after: hover it has 300px.
.portfolio_text{
height:30px;
}
#ho_nf:hover .portfolio_text {
height: 200px;
padding: 20px 14px;
overflow: visible;
}
Portfolio_text returns to normal height if I click outside the element's Div or click on another element in the list of 6.
What I need is to be able to return the text to the size of 30 by clicking on the close icon that I added in the left corner to see the background image again.
I tried with JQuery but it didn't work and I need it only on mobile because the Desktop is based on: hover and removing the mouse it goes back to the normal state.
There is no :hover pseudo-element for mobile since there is no cursor.
Try using :active.

Unexpected scrollbar: overflow and scroll, absolute div with :hover

I'm trying to build a pure-css mouse-over menu, where a DIV appears to the right of an item that is hovered. The basic idea is to use an absolute positioned DIV that appears on :hover
It will look like this (colors for debugging purposes)
Result
Relevant CSS
.hoverDiv:hover .hoverItem
{
background-color: green;
}
.hoverDiv:hover .hoverMenu
{
display:inline-block;
}
.hoverMenu
{
display:none;
position: absolute;
background-color: green;
left:100%;
top:0px;
}
This works great. However, if there are too many items I would like to have a (vertical) scrollbar. But when I add overflow-y:scroll, the hover effect also triggers a horizontal scrollbar.
See https://jsfiddle.net/g2g1zutb/12/ , the red section is 'wrong', the yellow section is OK, but has no scroll.
What would be the best way to solve this? Is it even possible in CSS only?

Show Hidden webbot in CSS

I've tried using the scenario in the link below too show hidden text when mouse over text. It works fine with text but what my client is needing is to hide the webbot HitCounter and show it when they place the mouse over. Any help would be greatly appreciated.
Show hidden text on hover (CSS)
<div id="DivForHoverItem">
<div id="HiddenText"><p class="auto-style4">
<!--webbot bot="HitCounter" i-image="0" I-ResetValue="0" I-Digits="0" U-Custom --></p></div>
</div>
</div>
CSS Code:
/* Div for hover item */
#DivForHoverItem {
height: 50px;
width: 300px;
background-color: black;
text-align:center;
}
#HiddenText {
display:none;
}
#DivForHoverItem:hover #HiddenText {
display:block;
}
Remember that display:none "removes" element (div do not occupy space) from layout. So You have nothing to point with cursor (without creating another wrapping div/divs with fixed size, or gettinng into js and conditions of another element) to start the hover effect.
So maybe outer wrapper div?
Maybe visibility: hidden in place display:none?
Maybe Changing the Z-Index?
Or another div on top of counter (covering it with background solid color) with alpha transparency change on hover (even fading out css animation) ?

Overlapping "Zoom" div blocking text and options select

First question on this page - yay!
I am currently building a website for a client and it is causing me some troubles.
I have a zoom-tool which allows the user to zoom an image, when the cursor is passing the picture.
This creates a "secret" div right on top of my text-div. The text-div contains a select-option dropdown. The "secret" div is blocking for any activity with in the text-div - I cannot highlight any text or select a option in the dropdown. This I am able to do, when I move the text-div away from the "secret" div.
See this page: http://shakermedia.dk/2up/2012/10/seville-modulsofa-sort/
What can I do? Here is the css code for the two divs:
div.zoom-box {
width:450px;
line-height: 0;
height:100%;
float:right;
position:relative;
z-index: 2;
}
div.text-alignment {
width:450px;
float:right;
margin-top:-419px;
height:100%;
position: relative;
}
How can I make the text-div accessible, but keeping the "zoom-box" the same place (overlapping text when zooming)?
Your help is very much appriciated!
you need to try giving the element that is behind a lower value of z-index and the element that is above - a higher z-index value