3
votes

In Chrome (Chromium 45), the ghost image for a draggable element is rendered on a white background. How can I force it to render the ghost image on a transparent background, like Firefox does?

Example: http://jsfiddle.net/c8p24q6y/
I have a dark background image (indicated by black color). When you drag the list items in Chrome, the ghost image has an ugly white background. In Firefox, the ghost image will have a transparent background.

<html>
<head>
    <style>
        body{
            background-color:black;
        }
        ul { list-style-type:none; }
        li *{
            display:inline-block;
            border-radius:10px;
            width:100px;
            height:23px;
            margin-right:8px;
            cursor:move;
        }
        li :first-child{ background-color:red; }
        li :last-child{ background-color:blue; }
    </style>
    <script>
        window.onload = function(){
            var dc = document.getElementById("drag_cont");
            dc.ondragstart = function(e){
                e.dataTransfer.setData("text/plain", "testing");
            };
        }
    </script>
</head>
<body>
    <ul id="drag_cont">
        <li draggable="true">
            <div></div><div></div>
        </li>
        <li draggable="true">
            <div></div><div></div>
        </li>
    </ul>
</body>
</html>
1
What OS are you on? I just tested on Chrome 46 on Mac and all is well - jsbin.com/sivaquk/latest - it might be a 45 issue, an OS issue or anything.Kinlan
I'm on Linux (Xubuntu). I just tried on windows, and it is working fine. So, I guess there isn't really anything I can do about it.Azmisov

1 Answers

0
votes

I had the same problem, but managed to fix it by installing Compton (a composite manager)! This was on Arch Linux using i3 as a WM. https://wiki.archlinux.org/index.php/Compton