html - Moving image in Javascript -
i have image , want when click on it, image moves according mouse , when release mouse image stays in position. can guide me on how in javascript?
looking this?
$(document).mousemove(function(e) { $('.logo').offset({ left: e.pagex, top: e.pagey + 20 }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <img class="logo" src="//ssl.gstatic.com/images/logos/google_logo_41.png" alt="google">
Comments
Post a Comment