Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2011
    Location
    Surrey United Kingdom
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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 09:02 PM. Reason: made edit more clear

  • #2
    Regular Coder
    Join Date
    Feb 2012
    Location
    Nebraska, USA
    Posts
    132
    Thanks
    8
    Thanked 19 Times in 19 Posts
    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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •