Skip to content

Instantly share code, notes, and snippets.

@stlsmiths
Created August 24, 2011 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stlsmiths/1168632 to your computer and use it in GitHub Desktop.
Save stlsmiths/1168632 to your computer and use it in GitHub Desktop.
YUI3 Resize with start event
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Resize Example</title>
<style type="text/css">
#demo {
height: 100px;
width: 100px;
border: 1px solid black;
background-color: #8DD5E7;
position: relative;
padding: 1em;
margin: 2em;
}
</style>
<script src="http://yui.yahooapis.com/3.4.0/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam ">
<div id="demo">Resize Me</div>
<script type="text/javascript">
YUI().use('resize', 'resize-plugin', function(Y) {
var resize = new Y.Resize({
//Selector of the node to resize
node: '#demo'
});
resize.plug(Y.Plugin.ResizeConstrained, {
minWidth: 50,
minHeight: 50,
maxWidth: 300,
maxHeight: 300,
preserveRatio: true
});
resize.on('resize:start',function(){ alert('fired resize:start event!');});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment