Last active
December 13, 2015 19:48
-
-
Save catarinavclemente/4965315 to your computer and use it in GitHub Desktop.
Draggable containment using the selector's parent and z-index increment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready (function() { | |
$("div,img").draggable({ containment: "parent" }); | |
var containment = $( "div,img" ).draggable( "option", "containment" ); | |
$("div,img").draggable( "option", "containment", "parent" ); | |
$(function($){ | |
var sqs = $("div,img").mousedown(function(){ | |
sqs.each(function(){ | |
if(this.style.zIndex > 0){--this.style.zIndex;} | |
}); | |
this.style.zIndex = 10000; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment