resize.html revision 9bb0211326638e5c88602753ef9a98d19d3fd43a
<html>
<head>
<title>Resize</title>
<style>
p, ul, li {
margin: 0;
padding: 0;
}
.resizable {
width: 100px;
height: 100px;
background: #BBCCFF;
overflow: hidden;
margin: 30px;
}
#r1, #r2 {
position: relative;
}
#r3 {
position: absolute;
top: 100px;
left: 300px;
}
#r4 {
position: fixed;
top: 100px;
left: 500px;
}
#r5 {
width: 250px;
height: 150px;
}
#r6 {
height: 238px;
width: 358px;
}
#r7 {
height: 121px;
width: 182px;
position: absolute;
top: 100px;
left: 100px;
}
#r7Container {
position: absolute;
top: 300px;
left: 500px;
height: 333px;
width: 500px;
border: 5px solid #BBCCFF;
}
/* knob handles demo */
.yui3-resize-knob .yui3-resize-handle-tr,
.yui3-resize-knob .yui3-resize-handle-br,
.yui3-resize-knob .yui3-resize-handle-tl,
.yui3-resize-knob .yui3-resize-handle-bl,
.yui3-resize-knob .yui3-resize-handle-b,
.yui3-resize-knob .yui3-resize-handle-t,
.yui3-resize-knob .yui3-resize-handle-l,
.yui3-resize-knob .yui3-resize-handle-r {
border: 1px solid #808080;
background-color: #F2F2F2;
height: 6px;
width: 6px;
}
.yui3-resize-knob .yui3-resize-handle-b,
.yui3-resize-knob .yui3-resize-handle-t {
left: 45%;
}
.yui3-resize-knob .yui3-resize-handle-l,
.yui3-resize-knob .yui3-resize-handle-r {
top: 45%;
}
.yui3-resize-knob .yui3-resize-handle-t,
.yui3-resize-knob .yui3-resize-handle-tr,
.yui3-resize-knob .yui3-resize-handle-tl {
top: -4px;
}
.yui3-resize-knob .yui3-resize-handle-b,
.yui3-resize-knob .yui3-resize-handle-br,
.yui3-resize-knob .yui3-resize-handle-bl {
bottom: -4px;
}
.yui3-resize-knob .yui3-resize-handle-l,
.yui3-resize-knob .yui3-resize-handle-bl,
.yui3-resize-knob .yui3-resize-handle-tl {
left: -4px;
}
.yui3-resize-knob .yui3-resize-handle-r,
.yui3-resize-knob .yui3-resize-handle-br,
.yui3-resize-knob .yui3-resize-handle-tr {
right: -4px;
}
.yui3-resize-knob .yui3-resize-handle-inner {
background: none;
height: 6px;
width: 6px;
}
/* */
</style>
</head>
<body class="yui3-skin-sam">
<h1>Resize</h1>
<div id="r1" class="resizable">relative</div>
<div id="r2" class="resizable">
relative, constrained
</div>
<div id="r3" class="resizable">
absolute<br/>
<button id="r3btn" type="button">Destroy resize</button>
</div>
<div id="r4" class="resizable">fixed</div>
<br/><br/>
<img id="r6" src="assets/team.jpg" alt="Eduardo Lundgren, Nate Cavanaugh and the YUI Team at Yahoo" />
<br/><br/>
<textarea id="r5">
Textarea
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</textarea>
<div id="r7Container" class="yui3-resize-knob">
<img id="r7" src="assets/team.jpg" alt="Eduardo Lundgren, Nate Cavanaugh and the YUI Team at Yahoo" />
</div>
</body>
<script type="text/javascript">
YUI({filter: 'raw'}).use('resize', function(Y) {
var r1 = new Y.Resize({
node: '#r1'
});
var r2 = new Y.Resize({
node: '#r2'
});
tickX: 20,
tickY: 20,
minWidth: 50,
minHeight: 50,
maxWidth: 300,
maxHeight: 300,
preserveRatio: true
});
var r3 = new Y.Resize({
node: '#r3',
proxy: true,
wrap: true
});
var r4 = new Y.Resize({
node: '#r4',
autoHide: true,
proxy: true
});
var r5 = new Y.Resize({
node: '#r5',
autoHide: true,
proxy: true
});
var r6 = new Y.Resize({
node: '#r6'
});
preserveRatio: true
});
var r7 = new Y.Resize({
node: '#r7'
});
// r7.on('resize', function(event) {
// console.log( event.currentTarget.get('activeHandle') );
// });
constrain: '#r7Container',
// preserveRatio: true,
minHeight: 50,
minWidth: 50
});
Y.one('#r3btn').on('click', function() { r3.destroy(); });
});
</script>
</html>