Mark
Mark

Reputation: 5653

javascript - stop browser highlighting images

I have made a script that allows users to drag images around. Unfortunatly though most browsers higlight the image blue. Is there a way to disable this behaviour in all browsers?

Upvotes: 1

Views: 698

Answers (1)

Tatu Ulmanen
Tatu Ulmanen

Reputation: 124828

Return false from your mousedown/mousemove handler to prevent default browser actions (default action is the select the underlying element on mousedrag).

EDIT

What I meant was this:

document.onmousemove = function() {
    // Do your stuff

    return false;
}

You might have different looking functions, but in the end, put return false.

Upvotes: 1

Related Questions