constrain-resize.mustache revision 35d039da10970deb9abb779286f19907ec86350c
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<div class="intro">
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<p>This example shows how to create a resizable element where the resize operation is constrained to a specific aspect ratio.</p>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<div class="example">
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync {{>constrain-resize-source}}
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<h3>Setting up the Node</h3>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<p>First we need to create an HTML element to make resizable.</p>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync{{>simple-resize-source-html}}
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<p>Next, we'll give that element some CSS to make it visible.</p>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync{{>simple-resize-source-css}}
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<h3>Setting up the YUI Instance</h3>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<p>Now we need to create our YUI instance and tell it to load the `resize` module. This module is a rollup that includes the `resize-constrain` submodule; that means we have access to the `ResizeConstrained` plugin.</p>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncYUI().use('resize');
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<h3>Making the Node resizable</h3>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<p>Now that we have a YUI instance with the `resize` module, we need to instantiate the `Resize` instance on this Node.</p>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync{{>simple-resize-source-js}}
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<h3>Adding the Constrained Plugin</h3>
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync<p>Now we will plug `ResizeConstrained` into our Resize instance. This plugin will allow you to limit the resize dimensions in special ways.</p>