简体   繁体   中英

Changing CSS property of the attribute “draggable”

Is it possible to change the CSS property of the attribute "draggable"

draggable="true"

Is it possible to change the default style given to the element by HTML??... When dragging, the element is transparent until it gets dropped, but I want it to be fully visible when being dragged. I was hoping to do this WITHOUT jquery UI.

 function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); ev.dataTransfer.setDragImage() } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("Text"); if (ev.target.className == "card-content") { ev.target.appendChild(document.getElementById(data)); } }
 .drag { width: 300px; height: 300px; padding: 5px; background-color: gray; }
 <body ondrop="drop(event)" ondragover="allowDrop(event)"> <div class="drag" draggable="true" ondragstart="drag(event)"> Drag Me </div> </body>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM