"img scrolling"
Bootstrap 4.1.1 Snippet by Swarajn

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <h2>A scrolling img with jquery</h2> <button type="button" class="btn btn-warning mb-2" data-toggle="modal" data-target="#myModal"> Open image </button><br> Plese try to drag on the big image for scrolling. <!-- The Modal --> <div class="modal fade" id="myModal" data-backdrop="static"> <span class="float-right close mr-2" data-dismiss="modal">×</span> <div class="modal-dialog"> <img class="bigimg" src="https://www.w3schools.com/html/img_girl.jpg"/> </div> </div> </div>
$(document).ready(function(){ $('.bigimg').mousemove(function(e){ var relY = e.pageY - $(this).offset().top; var relX = e.pageX - $(this).offset().left; $("#myModal").animate({ scrollTop: relY, scrollLeft: relX }, 1); }); });

Related: See More


Questions / Comments: