Skip to content

Instantly share code, notes, and snippets.

@ericmustin
Created December 6, 2016 14:43
Show Gist options
  • Select an option

  • Save ericmustin/6b81d160bc88661194a715f320dad5e6 to your computer and use it in GitHub Desktop.

Select an option

Save ericmustin/6b81d160bc88661194a715f320dad5e6 to your computer and use it in GitHub Desktop.
sickHatPipeGlasses
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Draggable - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<style>
#outer { width: 500px; height: 500px; background-size: 500px 500px; background-image: url(https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAAMsAAAAJGVhZmNjYTM2LTg3MjktNDE4MS04MGNjLThkMzlkZGE3YzJkYw.jpg); background-repeat: no-repeat; }
#draggable { width: 200px; height: 200px; border: none; background-color: transparent; }
#draggableTwo { width: 200px; height: 200px; border: none; background-color: transparent; }
#draggableThree { width: 200px; height: 200px; border: none; background-color: transparent; }
#hat { height: 100%; width: 100%; max-height: 100%; max-width: 100%; object-fit: contain; display: block;}
#sunglasses { height: 100%; width: 100%; max-height: 100%; max-width: 100%; object-fit: contain; display: block;}
#pipe { height: 100%; width: 100%; max-height: 100%; max-width: 100%; object-fit: contain; display: block;}
</style>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#draggable" ).draggable();
} );
$( function() {
$( "#draggableTwo" ).draggable();
} );
$( function() {
$( "#draggableThree" ).draggable();
} );
</script>
</head>
<body>
<div id="outer">
<div id="draggable" class="ui-widget-content">
<img id="hat" src="http://www.pngall.com/wp-content/uploads/2016/05/Hat-PNG-Clipart.png"/>
</div>
<div id="draggableTwo" class="ui-widget-content">
<img id="sunglasses" src="https://s-media-cache-ak0.pinimg.com/originals/26/ff/83/26ff83aacd34f3255061ef5bb8a8f2f5.png"/>
</div>
<div id="draggableThree" class="ui-widget-content">
<img id="pipe" src="http://www.pngpix.com/wp-content/uploads/2016/07/PNGPIX-COM-Smoking-Pipe-PNG-Transparent-Image-1-500x436.png"/>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment