Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, it is possible.</p> <p>Although it's totally doable with just javascript, I would use some kind of library like <a href="http://jquery.com/" rel="noreferrer">JQuery</a>.</p> <p>The approach would be to have an img-element with your marker, and then add a <a href="http://docs.jquery.com/Events/click#fn" rel="noreferrer">click</a>-handler to the image you want to use as your "map" which <a href="http://docs.jquery.com/CSS" rel="noreferrer">moves</a> your marker to where the element was clicked.</p> <p>Here is an untested example:</p> <pre><code>&lt;img src="marker.png" id="marker" style="display: none; position: absolute;" /&gt; &lt;img src="map.png" id="map" /&gt; &lt;script type="text/javascript"&gt; $('#map').click(function(e) { $('#marker').css('left', e.pageX).css('top', e.pageY).show(); // Position of the marker is now e.pageX, e.pageY // ... which corresponds to where the click was. }); &lt;/script&gt; </code></pre> <hr> <p><strong>Edit:</strong> And this is totally possible without JQuery too, of course. Below is a code-example of just that.</p> <pre><code>&lt;img src="marker.png" id="marker" style="display: none; position: absolute;" /&gt; &lt;img src="map.png" id="map" /&gt; &lt;script type="text/javascript"&gt; document.getElementById('map').onclick = function(e) { with(document.getElementById('marker')) { style.left = e.pageX; style.top = e.pageY; style.display = 'block'; } // Here you forward the coordinates e.pageX, e.pageY // ... to whatever function that needs it }; &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload