Position fixed like element in absolute element

I am trying to create a UI where whenever I hover on an element, the element specific description will be visible just adjacent to it. I somehow managed to make it work properly but now I came to know that when the elements are more then there should be scroller.

Doing the following, I get the scroller but now the description section is not moving with the scroller.

Fiddle

CSS

.wrapper {
    height: 180px;
    overflow-x: hidden;
    overflow-y: auto;
    width: 400px;
    background-color: red;
    position: relative;
}
.viewer {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: 200px;
    background-color: orange;
}
.item {
    width: 200px;
    height: 60px;
    background-color: green;
    cursor: pointer;
    outline: 1px solid black;
}
.item:hover {
    background-color: cornflowerblue;
}
.item:hover .viewer {
    display: block;
}

I am looking for a pure solution which works in modern browsers like IE10, chrome and firefox.


Source: html5

Leave a Reply