View Full Version : Multiple web backgrounds?

01-21-2012, 02:54 PM

What im basically trying to archive is, when i put an image on a web page you can drag the image to a new tab, and it will open. That's not really the problem, but more of an example. I need a way to stop you being able to drag the images, i think it just looks untidy.

I have a background image set, then a nav-bar, which is again an image and you can click and drag, i would like to prevent this.

Hopefully you know what i mean, this is of same problem i have. (http://stackoverflow.com/questions/4211909/disable-dragging-an-image-from-an-html-page)

Many thanks


Seems i found the solution, <div onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false">

02-03-2012, 06:38 PM
Also, another way to go about it would to simply change how you applied the background image to the div.

if you have it set as

<img src="image1.jpg" alt"" />

just change it to


which should make it unavailable for dragging since it's being called up in the CSS, not in the HTML