i build a website with draging of window like divs, but when somebody drags a div it sometimes selects some images.
so im looking for a way to disable selecting images all over the website, i know its posible but i dont know how.
You might try this--its an adaptation of the code you linked to.
Code:
window.onload = init;
function init() {
var i, x = document.getElementsByTagName('img');
for ( i = 0; i < x.length; i++){
disableDraggingFor(x[i]);
}
}
function disableDraggingFor(element) {
// this works for FireFox and WebKit in future according to http://help.dottoro.com/lhqsqbtn.php
element.draggable = false;
// this works for older web layout engines
element.onmousedown = function(event) {
event.preventDefault();
return false;
};
}
Bookmarks