New wiki-page
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
     width:100%;
     width:100%;
</style>
</style>
<script type="text/javascript">
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js">


function clicked(evt){
$(document).ready(function () {
     var e = evt.target;
     $("#map-catcher").mousedown(function (e) {
    var dim = e.getBoundingClientRect();
        $("#coord").text("x:"+e.offsetX+", y:"+e.offsetY);
    var x = evt.clientX - dim.left;
    });
    var y = evt.clientY - dim.top;
});
    alert("x: "+x+" y:"+y);
}  


</script>
</script>
<h1 id="coord">asdf</h1>
<div id="map-container">
    <object id="map-svg" type="image/svg+xml" data="http://upload.wikimedia.org/wikipedia/en/9/9a/Nickelodeon_logo.svg" style="width: 300px; height: 300px; border:1px solid black; ">Your browser does not support SVG</object>
    <div id="map-catcher"></div>
</div>

Revision as of 18:38, 9 August 2017

<style>

  1. map-container{
   position:relative;
   width:300px;
   height:300px;

}

  1. map-svg{
   position:absolute;
   left:0px;
   top:0px;

}

  1. map-catcher{
   position:absolute;
   left:0px;
   top:0px;
   height:100%;
   width:100%;

</style> <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js">

$(document).ready(function () {

   $("#map-catcher").mousedown(function (e) {
       $("#coord").text("x:"+e.offsetX+", y:"+e.offsetY);
   });

});

</script>

asdf

   <object id="map-svg" type="image/svg+xml" data="http://upload.wikimedia.org/wikipedia/en/9/9a/Nickelodeon_logo.svg" style="width: 300px; height: 300px; border:1px solid black; ">Your browser does not support SVG</object>