|
Slyweb
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="jquery-ui-1.7.2.custom.css"
rel="stylesheet" type="text/css"/>
<script src="jquery-1.3.2.min.js"></script>
<script src="jquery-ui-1.7.2.custom.min.js"></script>
<script>
$(document).ready(function(){
$(function() {
$("#resizable").resizable();
});
});
</script>
</head>
<body class="iframe">
<div class="demo">
<div id="resizable" class="ui-widget-content">
<h3 class="ui-widget-header">Resizable</h3>
</div>
</div><!-- End demo -->
<div style="display: none;" class="demo-description">
<p>Enable any DOM element to be resizable.
With the cursor grab the right or bottom
border and drag to the desired width or height.</p>
</div><!-- End demo-description -->
</body>
</html>
<style>
#resizable { width: 100px; height: 100px; padding: 0.5em; }
#resizable h3 { text-align: center; margin: 0; }
</style>
Опция: alsoResize
$('.selector').resizable({ alsoResize: '.other' });
//получить опцию
var alsoResize = $('.selector').resizable('option', 'alsoResize');
//установить опцию
$('.selector').resizable('option', 'alsoResize', '.other');
Опция: animate
$('.selector').resizable({ animate: true });
//получить опцию
var animate = $('.selector').resizable('option', 'animate');
//установить опцию
$('.selector').resizable('option', 'animate', true);
Опция: animateDuration
$('.selector').resizable({ animateDuration: 500 });
//получить опцию
var animateDuration = $('.selector').resizable('option', 'animateDuration');
//установить опцию
$('.selector').resizable('option', 'animateDuration', 500);
Опция: animateEasing
$('.selector').resizable({ animateEasing: 'swing' });
//получить опцию
var animateEasing = $('.selector').resizable('option', 'animateEasing');
//установить опцию
$('.selector').resizable('option', 'animateEasing', 'swing');
Опция: aspectRatio
$('.selector').resizable({ aspectRatio: .75 });
//получить опцию
var aspectRatio = $('.selector').resizable('option', 'aspectRatio');
//установить опцию
$('.selector').resizable('option', 'aspectRatio', .75);
Опция: autoHide
$('.selector').resizable({ autoHide: true });
//получить опцию
var autoHide = $('.selector').resizable('option', 'autoHide');
//установить опцию
$('.selector').resizable('option', 'autoHide', true);
Опция: cancel
$('.selector').resizable({ cancel: ':input,option' });
//получить опцию
var cancel = $('.selector').resizable('option', 'cancel');
//установить опцию
$('.selector').resizable('option', 'cancel', ':input,option');
Опция: containment
$('.selector').resizable({ containment: 'parent' });
//получить опцию
var containment = $('.selector').resizable('option', 'containment');
//установить опцию
$('.selector').resizable('option', 'containment', 'parent');
Опция: delay
$('.selector').resizable({ delay: 20 });
//получить опцию
var delay = $('.selector').resizable('option', 'delay');
//установить опцию
$('.selector').resizable('option', 'delay', 20);
Опция: distance
$('.selector').resizable({ autoHide: true });
//получить опцию
var distance = $('.selector').resizable('option', 'distance');
//установить опцию
$('.selector').resizable('option', 'distance', 20);
Опция: ghost
$('.selector').resizable({ ghost: true });
//получить опцию
var ghost = $('.selector').resizable('option', 'ghost');
//установить опцию
$('.selector').resizable('option', 'ghost', true);
Опция: grid
$('.selector').resizable({ grid: [50, 50] });
//получить опцию
var grid = $('.selector').resizable('option', 'grid');
//установить опцию
$('.selector').resizable('option', 'grid', [50, 50]);
Опция: handles
$('.selector').resizable({handles: 'n, e, s, w'});
//получить опцию
var handles = $('.selector').resizable('option', 'handles');
//установить опцию
$('.selector').resizable('option', 'handles', 'n, e, s, w');
Опция: helper
$('.selector').resizable({ helper: 'ui-state-highlight' });
//получить опцию
var helper = $('.selector').resizable('option', 'helper');
//установить опцию
$('.selector').resizable('option', 'helper', 'ui-state-highlight');
Опция: maxHeight
$('.selector').resizable({ maxHeight: 300 });
//получить опцию
var maxHeight = $('.selector').resizable('option', 'maxHeight');
//установить опцию
$('.selector').resizable('option', 'maxHeight', 300);
Опция: maxWidth
$('.selector').resizable({ minHeight: 150 });
//получить опцию
var minHeight = $('.selector').resizable('option', 'minHeight');
//установить опцию
$('.selector').resizable('option', 'minHeight', 150);
Опция: minWidth
$('.selector').resizable({ minWidth: 75 });
//получить опцию
var minWidth = $('.selector').resizable('option', 'minWidth');
//установить опцию
$('.selector').resizable('option', 'minWidth', 75);
Событие: start
$('.selector').resizable({
start: function(event, ui) { ... }
});
$('.selector').bind('resizestart', function(event, ui) {
...
});
Событие: resize
$('.selector').resizable({
resize: function(event, ui) { ... }
});
$('.selector').bind('resize', function(event, ui) {
...
});
Событие: stop
$('.selector').resizable({
stop: function(event, ui) { ... }
});
$('.selector').bind('resizestop', function(event, ui) {
...
});
Метод: destroy
Метод: disable
Метод: enable
Метод: option
Используемая тема jQuery UI
Образец разметки jQuery UI CSS струтктуры классов
<div class="ui-resizable"> <div style="-moz-user-select: none;" unselectable="on" class="ui-resizable-handle ui-resizable-e"></div> <div style="-moz-user-select: none;" unselectable="on" class="ui-resizable-handle ui-resizable-s"></div> <div unselectable="on" style="z-index: 1001; -moz-user-select: none;" class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se"></div> </div>Примечание: Данный образец разметки создан через плагин resizable, это не разметка для того чтобы изменять размер элемента. Для изменения достаточно следующей разметки <div></div>.