giniedp / spritespin

jQuery plugin for spriteanimation.
http://giniedp.github.com/spritespin/
MIT License
377 stars 122 forks source link

Disable right mouse click and middle mouse-wheel click #57

Closed Jogii closed 6 years ago

Jogii commented 6 years ago

Is there a possible within spritespin.js plugin to disable the right mouse click and middle mouse-wheel click?

giniedp commented 6 years ago

This is something you are free to handle yourself outside of spritespin. For example to disable the contextmenu

<div id="my-spin" oncontextmenu="return false"></div>

Or handle the clicks

$("#my-spin").click(function(e) {
  // do whatever you want and prevent the click if needed
  if (e.which == 2) {
    e.preventDefault();
  }
})
Jogii commented 6 years ago

@giniedp Thanks for quick reply. Actually i was working on a 360 degree spin on a set of images and wanted to restrict the spin on right and middle mouse click drag. Achieved the same by implementing the below code on dragstart function modules:-

  if(e.button !== 0) {
        data.dragging = false;
    } else {
        data.dragging = true;
    }