How can I made this

S

SAM

Le 10/10/08 8:06 AM, Vicent a écrit :
Please,
If you see this page:

http://www.gpsies.com/map.do?fileId=jvillngyqmhldkby

You will see a static image with altitude progfile, you can move the
mouse over it and horizontal line appears. Can anybody help me and
tell me how can I do this?

I think it could be easy to do:

the line is a simple div whom position follows the mouse's cursor

css:
====
#demo { position: relative; width: 500px; height: 300px; }
#demo img { width: 100%; height: 100%; }
#line { position: absolute; top: 0; width: 2px; height: 100%;
background: green; display: none; }

JS :
====
function line(evt) {
evt = evt || window.evt;
var x1 = document.getElementById('demo').offsetLeft-1;
var x2 = evt.clientX? evt.clientX : evt.X;
document.getElementById('line').style.left = x2 - x1 +'px';
}

html :
======
<div id="demo">
<img src="asm1.gif" alt=""
onmouseover="document.getElementById('line').style.display='block';"
onmousemove="line(event);"
onmouseout="document.getElementById('line').style.display='';">
<div id="line"></div>
</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top