Skip to content

Instantly share code, notes, and snippets.

@juandopazo
Created September 1, 2011 17:52
Show Gist options
  • Save juandopazo/1186777 to your computer and use it in GitHub Desktop.
Save juandopazo/1186777 to your computer and use it in GitHub Desktop.
Constrain resize and drag plugins
YUI().use('overlay', 'resize-plugin', 'resize-constrain',
'dd-plugin', 'dd-constrain', function (Y) {
var overlay = new Y.Overlay({
width: 80,
height: 80,
x: 30,
y: 30
});
overlay.plug([Y.Plugin.Resize, Y.Plugin.Drag]);
overlay.dd.plug(Y.Plugin.DDConstrained, {
constrain: '#test'
});
overlay.resize.plug(Y.Plugin.ResizeConstrained, {
constrain: '#test',
minWidth: 50,
minHeight: 50
});
overlay.render('#test');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment