control the position of the mouseover preview window of an image with multiple links

Viewed 25

I have an image with multiple links using a map. The map identify links in different area of the image with the coords.

I also add mouseover preview window to the image's links.

I want the mouseover preview window to be under the area of the link. Right now the position is kind of random.

$(function() {
  $('#p2 area').miniPreview({ prefetch: 'parenthover' });
});
.mini-preview-anchor {
    display: inline-block;
    position: relative;
    white-space: nowrap;
}
.mini-preview-wrapper {
    -moz-box-sizing: content-box;
    box-sizing: content-box;
    position: relative;
    overflow: hidden;
    z-index: -1;
    opacity: 0;
    border: solid 1px #000;
    box-shadow: 4px 4px 6px rgba(0, 0, 0, .3);
    transition: z-index steps(1) .3s, opacity .3s, margin-top .3s;
}

.mini-preview-anchor:hover .mini-preview-wrapper {
    z-index: 2;
    opacity: 1;
    margin-top: 6px;
    transition: opacity .3s, margin-top .3s;
}

.mini-preview-loading, .mini-preview-cover {
    position: absolute;
    right: 10px;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;    
}

.mini-preview-loading {
    display: table;
    height: 100%;
    width: 100%;
    font-size: 1.25rem;
    text-align: center;
    color: #f5ead4;
    background-color: #59513f;
}

.mini-preview-loading::before {
    content: 'Loading...';
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

.mini-preview-cover {
    background-color: rgba(0, 0, 0, 0); /* IE fix */
}

.mini-preview-frame {
    border: none;
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    
}
<head>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js">  </script>  
  <script src="https://rawgit.com/shaneapen/Image-Preview-for-Links/master/image_preview_for_links.js"></script>
</head>

<p id="p2">
<img src="https://cdn.educba.com/academy/wp-content/uploads/2018/09/Top-Uses-Of-HTML.jpg" usemap="#yourmap" border="0" style="width:500px;height:300px">
<map name="yourmap">
<area shape="rect" coords="200,200,260,290" href="https://codegena.com">
<area shape="rect" coords="0,0,27,35" alt="Computer"href="https://codegena.com">
<area shape="rect" coords="400,50,490,150" alt="Computer" href="https://codegena.com">
</map>
</p>

0 Answers
Related