www.webdeveloper.com
Results 1 to 4 of 4

Thread: Disable selecting images

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    11

    Disable selecting images

    Sup guys,

    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.

  2. #2
    Join Date
    Oct 2005
    Location
    Cambridgeshire, UK
    Posts
    191
    Hi Nathan,

    Are you using the jQuery UI to perform the draggable instances? If so there is a disableSelection() function that may be of use.

    Aside from that, I'm afraid i'm not sure.

    Good luck !
    BIOSTALL.com
    - Freelancing Services
    - Web Development Snippets, Hints and Tips

  3. #3
    Join Date
    Sep 2010
    Posts
    11
    no im not using jquery ui, does any one else have an idea

    i have found something but i dont know how to enable it on all images:
    http://wiki.forum.nokia.com/index.ph...n_in_web_pages

  4. #4
    Join Date
    Mar 2009
    Posts
    495
    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;
                  };
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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
  •  
HTML5 Development Center



Recent Articles