jQueryUI의 resizable는 snap속성이 없다.


library를 다운 받고 다음과 같이 snap옵션을 사용할수 있다.


jQuery-UI-Resizable-Snap-extension-master.zip

https://github.com/polomoshnov/jQuery-UI-Resizable-Snap-extension



<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="lib/jQueryUI/1.12.1/jquery-ui.min.css">
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
body {
position: relative;
}
.box {
width: 300px;
height: 300px;
position: absolute;
border: 1px solid #000;
}
#box1 {
left: 50px;
top:50px;
}
#box2 {
left: 450px;
top:250px;
}
</style>
<script type="text/javascript" src="lib/jQuery/2.2.3/jquery.min.js"></script>
<script type="text/javascript" src="lib/jQueryUI/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="lib/jQuery-UI-Resizable-Snap-extension-master/jquery.ui.resizable.snap.ext.js"></script>
</head>
<body>
<div id= "box1" class="box"></div>
<div id= "box2" class="box"></div>
</div>
<script type="text/javascript">
$( ".box" ).resizable({
snap : true,
handles : 'all'
}).draggable({
snap : true
});
</script>
</body>
</html>


반응형
Posted by 힘없는염소