javascript - Custom hover tags like Thinglink -


i'm trying find way simulate thinglink does.

i attach picture can understand better. essentially, dot in picture, , when hover mouse, display text box.

my ideas begin are, tooltip within bootstrap, doesn't know sure if can make on picture...

thinglink picture

edit:

add actual code:

<div class="col-md-4 column wow fadeinright delay=1000ms">     <div id="tooltip1" data-toggle="tooltip" data-placement="top" title="keyword1">         <div id="tooltip2" data-toggle="tooltip" data-placement="left" title="keyword2">             <div id="tooltip3" data-toggle="tooltip" data-placement="bottom" title="keyword3">                 <img src="img/iphone_screenshot.png" alt="ios" />             </div         </div>     </div> </div> 

solution:

thanks @wouter florijn added bootstrap tooltip , transparent img 16x16, beacuase needed tooltip work. (can't hover in empty zone...)

<img src="img/iphone_screenshot.png" alt="ios" /> <div class="dot" data-x="20%" data-y="25%"><a href="#" rel="tooltip" title="feature 1"><img src="img/dot_transparent.png"/></a></div> <div class="dot" data-x="80%" data-y="50%"><a href="#" rel="tooltip" title="feature 2"><img src="img/dot_transparent.png" /></a></div> <div class="dot" data-x="35%" data-y="80%"><a href="#" rel="tooltip" title="feature 3"><img src="img/dot_transparent.png" /></a></div> <div class="dot" data-x="55%" data-y="15%"><a href="#" rel="tooltip" title="feature 4"><img src="img/dot_transparent.png" /></a></div>  

you need make container div picture , add number of absolutely positioned divs inside container.

it best position dots using js think.

then, add tooltips .dot divs using whatever want. jquery ui, bootstrap, foundation... or own code of course.

https://jsfiddle.net/7whlrjry/1/

html:

<div class="container">     <img src="..." />     <div class="dot" data-x="20%" data-y="25%"></div>     <div class="dot" data-x="80%" data-y="50%"></div>     <div class="dot" data-x="35%" data-y="80%"></div>     <div class="dot" data-x="55%" data-y="15%"></div> </div> 

css:

.container {     position: relative;     max-width: 100%; } .container img {     max-width: 100%; } .dot {     position: absolute;     width: 16px;     height: 16px;     background-color: black;     border: 8px solid white;     border-radius: 99999px;     cursor: pointer; } .dot:hover {     background-color: white;     border: 8px solid black; } 

js:

$(document).ready(function() {     $('.dot').each(function() {         $(this).css('left', $(this).data('x'));         $(this).css('top', $(this).data('y'));     }); }); 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -