cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <center>
<div id="main">

<div id="one" class="left_side"><h4>Metaphysical</h4></div>
<div id="two" class="left_side"><h4>Physical Reality</h4></div>
<div id="three" class="left_side"><h4>Hyperrealistic</h4></div>
  
<div class="clear"></div>

<div id="dragcenter">
<div id="object1">the time for relaxing in a natural setting</div>
<div id="object3">what Ronnie said when he felt the toad</div>
<div id="object5">the camaraderie in the cabin</div>
<div id="object2">unresponsive counselors</div>
<div id="object7">waiting for Ronnie without giving it away</div>
<div id="object6">unrestricted cabin behaviors</div>
<div id="object8">trouble catching the toad</div>
<div id="object4">the after-dinner campfire</div>
</div><!--end dragcenter-->

<div class="clear"></div>

<div id="feedback"></div>
<div id="logo">
<img src="http://griffininsight.com/img/griff_logo_black.png" alt="griffin insight logo">
</div>
<div class="clear"></div>
</div><!--end main-->
</center>
            
          
!
            
              body
{
margin: 0px;
padding: 0px;
font-family:Arial, Helvetica, sans-serif;
}

.clear { clear: both; display: block; }
.f_right { float: right; }
.f_left { float: left; }
.hidden { display: none; }

#main
{
border: 0px ridge #3399cc;
width: 700px;
padding: 10px;
}

#one { height: 280px; }
#two { height: 280px; }
#three { height: 280px; }

.left_side
{
width: 220px;	
border:  2px solid #039;
text-align: center !important;
float: left;
margin: 0px auto 0px 7px;

}

#dragcenter
{
padding: 0px auto 0px auto;
text-align: center;
border: 0px dashed #ff0000;
width:685px;
height:150px;
margin-top:10px;
margin-left:5px;
}

#object1, #object2, #object3, #object4, #object5, #object6, #object7, #object8
{
font-size:.95em;
width: 146px;
background-color: #1e8da8;
border: 2px ridge #000000;
color: #fff;
cursor: pointer;
text-align: center;
padding: 6px;
margin: 4px;
float: left;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
/* Prevent text from being selectable */
-webkit-touch-callout: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}

#feedback
{
border: 0px solid #ff0000;
float: left;
background-color: transparent;
color: #000000;
width: 40%;
margin:0px;
padding:0px 0px 0px 0px;
}

#logo
{
border: 0px ridge #33ff00;
float: right;
width: 158px;
padding: 0px 0px 0px 0px;
text-align: center;
}
            
          
!
            
              var object1 = document.getElementById('object1');
var object2 = document.getElementById('object2');
var object3 = document.getElementById('object3');
var object4 = document.getElementById('object4');
var object5 = document.getElementById('object5');
var object6 = document.getElementById('object6');
var object7 = document.getElementById('object7');
var object8 = document.getElementById('object8');

var objArray = ['#object1', '#object2', '#object3', '#object4', '#object5', '#object6', '#object7', '#object8'];
//var targArray = ['#target1', '#target2', '#target3', '#target4', '#target5'];
var startDrag = '';
var resetter = 0;
//var draggable = ui.draggable;

//jQ
var j = jQuery.noConflict();
j(document).ready(function()
{
//draggin
j('#object1, #object2, #object3, #object4, #object5, #object6, #object7, #object8').draggable
({
start: function(event,ui) {
startDrag = ui.position;
//console.log(startDrag);
},
	containment: '#main',
	cursor: 'move',
	//snap: '#target1',
	//snapMode: 'inner',
	//snapTolerance: 35,
	//revert: wrong,//call the wrong function on revert
	//revert: true,
	revert: function(valid)
		{
		if(!valid)
			{
			//this.remove();
			j('#feedback').html('<h3>Try again!</h3>');
			return true;
			}
		},	
	stack: 'div',//bring it to the top by adjusting z-index of the element
	drag: clearer,
	stop: function(event,ui)
		{
		//console.log("finished");
		}
	});
	
//droppables	
j('#one').droppable
	({
	drop: right,
	accept: '#object7 , #object8'
	//tolerance: intersect
	});
j('#two').droppable
	({
	drop: right,
	accept: '#object5 , #object4 , #object1'
	});
	
j('#three').droppable
	({
	drop: right,
	accept: '#object3 , #object6 , #object2'
	});

});//end on doc load

//EXTERNAL METHODS

//clear the feedback div onDrag
function clearer(event, ui)
{ j('#feedback').html(''); }

//if the dropTarget is correct
function right(event, ui)
{
j('#feedback').html('<h3>Correct!</h3>');
var draggable = ui.draggable;
draggable.draggable('disable');
draggable.draggable('option', 'revert', false);//turn revert off
//draggable.offset(j(this).offset());//lock it on top of the targets x and y
draggable.css('background-color','#ffffff');
draggable.css('color','#09C');
resetter++;
if (resetter == 8)
	{
	//console.log(resetter);
	j('#feedback').html('<h3 class="greentext">Congratulations! All correct!</h3>');
	j('#logo').html('<button type="button" onclick="resetIt()">Reset</button>');
	}
else
	{
	//do nothing
	}
}

//on reset button click
function resetIt() {
resetter = 0;
j('#feedback').html('');
j('#logo').html('<img src="http://griffininsight.com/img/griff_logo_blue.png" alt="griffin insight logo">');
//console.log(objArray);
for (x = 0; x < objArray.length; x++)
	{
	j(objArray[x]).css('left', '0');
	j(objArray[x]).css('top', '0');
	//j(objArray[x]).css('float', 'left');
	j(objArray[x]).css('background-color', '#09C');
	j(objArray[x]).css('color','#fff');
	j(objArray[x]).draggable('enable');//re-enable the draggable state
	j(objArray[x]).draggable({revert: function(valid) //gotta recall the revert function
		{
		if(!valid)
			{
			//this.remove();
			j('#feedback').html('<h3>Try again!</h3>');
			return true;
			}
		}
		});
	}
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console