views:

104

answers:

5

When you drag an image , there is a semi-transparent ghost image that follow your mouse when you hold it down.

Is there some way to apply CSS/JS to remoe this effect on a certain portion?

A: 

You could try using css background images instead of actual images with the img tag.

Tim
A: 

I'm afraid it's the browser behaviour/feature. I'm not sure of any specific FF CSS style which can handle that.

You might want to modify the Firefox's code to have your own firefox. If you are looking for some means to do it non-programmatically, I guess you have to post in superuser.com :P

o.k.w
+2  A: 

The only way to disable that in the browser (It does the same thing in Safari) is by returning false from the onmousedown event on the img element (or event.preventDefault()) and by handling the rest of the drag operation with javascript.

Pretty much every major JavaScript library has support for 'dragging' and 'dropping'. You could use their code as a starting place or just use it outright if you already are using a library on your page.

Doug Neiner
A: 

There is be a Firefox option in about:config to turn this off - nglayout.enable_drag_images - but obviously that will only work for you. I'm guessing you want to remove it for all visitors?

If you want to do drag & drop, maybe try jQuery UI or another JS library? You should be able to move other elements quite easily, and you could use a background image like Tim said on one of those.

Another advantage to that is you can use CSS sprite effects to reduce HTTP requests. I made a jigsaw puzzle with jQuery UI, which is actually only one image, but it looks like several.

DisgruntledGoat
there is: http://kb.mozillazine.org/Nglayout.enable_drag_images
Hans Passant
Thanks, edited.
DisgruntledGoat
A: 

You need to return false from the ondragstart event. I had this issue myself, and that's how I've solved it. It's an issue in IE7 as well. The problem is IE's drag and drop api, its standardisation into html5, and firefox's subsequent implementation of it.

Others suggestions of using a javascript library for drag and drop won't work. (I was already using jquery UI), as this is a recent thing in firefox, and jQuery UI doesn't seem to account for it.

Breton