I have this:
<style>
#pic_wrapper{
display: block;
position: relative;
padding: 0;
}
#selected_picture img {
width: 100%;
height: auto;
}
.pin {
display: none;
position: absolute;
height: 50px;
width: 50px;
padding: 0;
margin: 0;
}
</style>
<div id="pic_wrapper">
<div id="selected_picture">
<img src="map.png" />
</div>
</div>
and append markers to the image with:
<script type="text/javascript" charset="UTF-8">
$(function(){
$('#selected_picture').on('click', function(e){
offset = $('#selected_picture').offset();
x = e.pageX - offset.left - 25;
y = e.pageY - offset.top - 25;
var pin = $('<div class="pin"><img class="pin-img" src="pin.png" /></div>');
pin.uniqueId();
$('#pic_wrapper').append(pin);
pin.css('left', x).css('top', y).show();
I need to scale the #selected_picture together with all pins so that they remain at the same relative positions.
I found this example for text in a div: https://codepen.io/chriscoyier/pen/VvRoWy
But I can figure out how to apply the approach to my resizable picture with absolutely positioned pins on it.
Thank you for your help.