I've implemented AngularJs to create a grid with repeated li elements, each displaying a description box when hovered over. However, I am facing an issue where the description box goes off-screen when hovering over items on the right side of the grid.
Check out this jsfiddle for clarification:
ul {
width: 100%;
margin: 0;
padding: 0;
}
li {
position: relative;
display: inline-block;
vertical-align: top;
margin: 0;
width: 20%;
padding: 5px;
}
li:hover .info {
opacity: 1;
transition: 0.5s;
}
.image {
width: 100%;
background-color: red;
height: 100px;
}
.info {
position: absolute;
background-color: yellow;
padding: 0px 5px;
width: 200%;
top: 0;
left: 100%;
opacity: 0;
transition: 0.5s;
z-index: 100;
}
<ul>
<li>
<div class="image"></div>
<p>Hover over me</p>
<div class="info">
<p>Description Here</p>
</div>
</li>
// More li elements
</ul>
The layout of my grid is responsive, making it difficult to determine which side of the screen an item will be located on. Is there a way to dynamically change the grid item class in Angular based on its position within the grid?
Thank you!