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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -