I am developing a project and the default drag-drop behaviour is not desirable for me. So instead of writing draggable="false"
onto all of my <a>
and <img>
tags I am using jQuery to set there draggable
attributes on ready.
$('a, img').attr('draggable', 'false');
But I also have content that is added dynamically, so again I am calling the function that sets dragging to false when that content is loaded.
My question is, why is this behaviour enabled in the first place? Shouldn't it be the the developers choice to enable dragging or not? - I have been force to go to some lengths to disable dragging, perhaps there is a better solution. Does it contradict the Semantics of HTML to enable behaviour by default? i.e A plain <a href="#">
doesn't describe it as being draggable, but it is.
Links and Pictures are draggable from default so that you can drag them to a search-bar/browser-tag to only show the image or specific link.
If you want to turn off this default behaviour you can use this css-code: e.g for an img-tag
img
{
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
I haven't used it for links, but it should work too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With