Is there a way to enable resizing and dragging for each image?
Below is a snippet of code that allows users to select which image they would like to display. They have the option to choose multiple images if they prefer.
I am looking to implement functionality that will allow users to resize and drag the selected image within a designated div container.
$(document).ready(function() {
$('#imajes').change(function() {
$('.subselector').hide();
$('.smallimages').hide();
$('#' + $(this).val()).show();
});
$('.smallimages').hide();
var id = $(this).attr('id');
var val = $(this).val();
$('#dog').on('change', function() {
$("#bulldogimges").css('display', (this.value == 'bulldog') ? 'block' : 'none');
});
$('img').on('click', function() {
$('#fotos').append('<img class="modal-content" src="' + $(this).attr('src') + '">');
$('#fotos').draggable();
$('#imgdisplay').resizable();
});
});
.imgcontainerss {
float: left;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div id="fotos">
<img class="modal-content" id="imgdisplay" />
</div>
<select id="imajes">
<option value="">Choose Image</option>
<option value="dog">Dog</option>
</select>
<select id="dog" name="subselector" class="subselector" style="display:none">
<option value="">Choose an item</option>
<option value="bulldog">Bulldog</option>
</select>
<div style='display:none;' id="bulldogimges" class="smallimages">
<div class="imgcontainerss" data-image="https://torcdesign.com/clipart/pT78gE6pc.gif">
<img src="https://torcdesign.com/clipart/pT78gE6pc.gif" alt="Smiley face" width="55" height="55">
</div>
<div class="imgcontainerss" data-image="https://torcdesign.com/clipart/LiKkRqkeT.gif">
<img src="https://torcdesign.com/clipart/LiKkRqkeT.gif" alt="Smiley face" width="55" height="55">
</div>
</div>