When an image is rotated 90 degrees inside a modal, the img-responsive feature stops working and the image height exceeds the modal height.
function rotateImage(){
var angle = ($('#testImg').data('angle') + 90) || 90;
$('#testImg').css({'transform': 'rotate(' + angle + 'deg)'});
$('#testImg').data('angle', angle);
}
$(document).ready(function() {
$('.modal').modal('show');
})
.modal {
overflow-y: scroll;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Title</h4>
</div>
<div class="modal-body">
<img id="testImg" class="img-responsive" src="http://wallpapercave.com/wp/LYiEQH6.jpg">
<button class="btn btn-primary" onclick="rotateImage()"></button>
</div>
<div class="modal-footer">
<button type= "button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>