LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

HTML5 Drag and Drop example

Good Guys

Bad Guys

CSS
body {
  font-family: "Helvetica Neue", Helvetica, Arial;
  color: #333;
}
#user-levels {
	width: 900px;
	margin: 0 auto;
}
h2 {
  padding: 0;
  margin: 0 0 .5em 0;
  font-size: 1.3em;
}

#badguys, #goodguys, #unassigned {
	float: left;
	width: 202px;
	height: 230px;
	padding: 5px 10px;
	margin-right: 10px;
	background: #eee;
	text-align: center;
  background: #fff;
  box-shadow: 
    0px 0px 0px 5px rgba( 255,255,255,0.4 ), 
    0px 0px 12px rgba( 0,0,0,0.33 );
  border-radius: 5px;
  border: 1px solid #cacaca;
}
.user {
	width: 100px;
	padding: 3px 5px;
	display: block;
	margin: 0 auto 3px;
	text-align: center;
	border: 1px solid #aaa;
	background: #ddd;	
	cursor: move;
  border-radius: 5px;
}

.clear {
	clear: both;
}
JS
function dragUser(user, event) {
    event.dataTransfer.setData('User', user.id);
}
function dropUser(target, event) {
    var user = event.dataTransfer.getData('User');
    target.appendChild(document.getElementById(user)); 
}
Host Instantly Drag and Drop Website Builder

 

Description

Modified example from .net magazine
Term
Mon, 11/27/2017 - 21:40

Related Codes

Pen ID
Pen ID
Pen ID