Firefox has this annoying behavior that it let's the user drag and drop any image element by default. How can I cleanly disable this default behavior with jQuery?
Firefox has this annoying behavior that it let's the user drag and drop any image element by default. How can I cleanly disable this default behavior with jQuery?
If Javascript is an optional requirement, you can try with CSS
.wrapper img {
pointer-events: none;
}
You can cover your image with an empty div element:
.img-container{
position: relative;
}
.prevent-drag{
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
}
<div class="img-container">
<div class="prevent-drag"></div>
<img src="" />
</div>