Go Back   CodingForums.com > :: Client side development > Graphics and Multimedia discussions

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2012, 02:54 PM   PM User | #1
cartoongeorge96
New Coder

 
Join Date: Sep 2011
Location: Surrey United Kingdom
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
cartoongeorge96 is an unknown quantity at this point
Smile Multiple web backgrounds?

Hello,

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.

Many thanks

George

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

Last edited by VIPStephan; 01-24-2012 at 08:02 PM.. Reason: made edit more clear
cartoongeorge96 is offline   Reply With Quote
Old 02-03-2012, 06:38 PM   PM User | #2
dylanbaumannn
Regular Coder

 
Join Date: Feb 2012
Location: Nebraska, USA
Posts: 132
Thanks: 8
Thanked 19 Times in 19 Posts
dylanbaumannn is an unknown quantity at this point
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
Code:
<div>
<img src="image1.jpg" alt"" />
</div>
just change it to
Code:
div{
background-image:url(image1.jpg);
}
which should make it unavailable for dragging since it's being called up in the CSS, not in the HTML
dylanbaumannn is offline   Reply With Quote
Reply

Bookmarks

Tags
disable, dragging, images, mousedown

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:25 PM.


Advertisement
Log in to turn off these ads.