David Debnar
David Debnar

Reputation: 125

Weird image moving on html site

I'm making a web site and suddenly I ran into a problem. It's not huge, but I would like to fix it. On my site I have many images but there is a glitch. The images are "dragable". I mean when you click on a image and than move your mouse the images are being dragged. How can that be fixed?

http://nitidus-consto.kilu.org/

Upvotes: 0

Views: 470

Answers (1)

Matteo
Matteo

Reputation: 8142

It is always like this. Don't find anything weird in it.

Anyway this link can help you:

http://www.redips.net/firefox/disable-image-dragging/

you can use javascript to avoid the image dragging:

html file:

<!-- right image (dragging disabled) -->
<img src="image.png" onmousedown="if (event.preventDefault) event.preventDefault()">

javascript:

// register onLoad event with anonymous function
window.onload = function (e) {
var evt = e || window.event,// define event (cross browser)
    imgs,                   // images collection
    i;                      // used in local loop
// if preventDefault exists, then define onmousedown event handlers
if (evt.preventDefault) {
    // collect all images on the page
    imgs = document.getElementsByTagName('img');
    // loop through fetched images
    for (i = 0; i < imgs.length; i++) {
        // and define onmousedown event handler
        imgs[i].onmousedown = disableDragging;
    }
 }
 };

 // disable image dragging
 function disableDragging(e) {
     e.preventDefault();
 }

Upvotes: 3

Related Questions