JQuery UI - resizable
·概述 resizable插件可以让选中的元素具有改变尺寸的功能。
官方示例地址:http://jqueryui.com/demos/resizable/
所有的事件回调函数都有两个参数:event和ui,浏览器自有event对象,和经过封装的ui对象
ui.helper - 表示当前被改变尺寸的元素的JQuery对象
ui.originalPosition - 表示未改变尺寸之前元素的位置{top,left}
ui.originalSize - 表示未改变尺寸之前元素的大小{width,height}
ui.position - 表示当前被改变尺寸的元素的坐标值对象{top,left}
ui.size - 表示当前被改变尺寸的元素的大小值对象{width,height}
·参数(参数名 : 参数类型 : 默认值)
alsoResize : Selector, jQuery, ElementDefault : false
当调整元素大小时,同步改变另一个(或一组)元素的大小。
初始:$('.selector').resizable({ alsoResize: '.other' });
获取:var alsoResize = $('.selector').resizable('option', 'alsoResize');
设置:$('.selector').resizable('option', 'alsoResize', '.other');
animate : Boolean : false
在调整元素大小结束之后是否显示动画
初始:$('.selector').resizable({ animate: true });
获取:var animate = $('.selector').resizable('option', 'animate');
设置:$('.selector').resizable('option', 'animate', true);
animateDuration : Integer, String : 'slow'
动画效果的持续时间。(单位:毫秒)可选值:'slow', 'normal', 'fast'
初始:$('.selector').resizable({ animateDuration: 500 });
获取:var animateDuration = $('.selector').resizable('option', 'animateDuration');
设置:$('.selector').resizable('option', 'animateDuration', 500);
animateEasing : String : 'swing' 选择何种动画效果。
初始:$('.selector').resizable({ animateEasing: 'swing' });
获取:var animateEasing = $('.selector').resizable('option', 'animateEasing');
设置:$('.selector').resizable('option', 'animateEasing', 'swing');
aspectRatio : Boolean, Float : false
如果设置为true,则元素的可调整尺寸受原来大小的限制。例如:9 / 16, or 0.5
初始:$('.selector').resizable({ aspectRatio: .75 });
获取:var aspectRatio = $('.selector').resizable('option', 'aspectRatio');
设置:$('.selector').resizable('option', 'aspectRatio', .75);
autoHide : Boolean : false
如果设置为true,则默认隐藏掉可调整大小的手柄,除非鼠标移至元素上。
初始:$('.selector').resizable({ autoHide: true });
获取:var autoHide = $('.selector').resizable('option', 'autoHide');
设置:$('.selector').resizable('option', 'autoHide', true);
cancel : Selector : ':input,option'
阻止resizable插件加载在与你匹配的元素上。
初始:$('.selector').resizable({ cancel: ':input,option' });
获取:var cancel = $('.selector').resizable('option', 'cancel');
设置:$('.selector').resizable('option', 'cancel', ':input,option');
containment : String, Element, Selector : false
控制元素只能在某一个元素的大小之内改变。允许值:'parent', 'document', DOM元素, 或一个选择器.
初始:$('.selector').resizable({ containment: 'parent' });
获取:var containment = $('.selector').resizable('option', 'containment');
设置:$('.selector').resizable('option', 'containment', 'parent');
delay : Integer : 0
以毫秒为单位,当发生鼠标点击手柄改变大小,延迟多少毫秒后才激活事件。
初始:$('.selector').resizable({ delay: 20 });
获取:var delay = $('.selector').resizable('option', 'delay');
设置:$('.selector').resizable('option', 'delay', 20);
distance : Integer : 1
以像素为单位,当发生鼠标点击手柄改变大小,延迟多少像素后才激活事件。
初始:$('.selector').resizable({ distance: 20 });
获取:var distance = $('.selector').resizable('option', 'distance');
设置:$('.selector').resizable('option', 'distance', 20);
ghost : Boolean : false
如果设置为true,则在调整元素大小时,有一个半透明的辅助对象显示。
初始:$('.selector').resizable({ ghost: true });
获取:var grid = $('.selector').resizable('option', 'ghost');
设置:$('.selector').resizable('option', 'ghost', true);
grid : Array : false
设置元素调整的大小随网格变化,允许的数据为:{x,y}
初始:$('.selector').resizable({ grid: [50, 50] });
获取:var grid = $('.selector').resizable('option', 'grid');
设置:$('.selector').resizable('option', 'grid', [50, 50]);
handles : String, Object : 'e, s, se'
设置resizable插件允许生成在元素的哪个边上,可选值:n, e, s, w, ne, se, sw, nw, all
初始:$('.selector').resizable({ handles: 'n, e, s, w' });
获取:var handles = $('.selector').resizable('option', 'handles');
设置:$('.selector').resizable('option', 'handles', 'n, e, s, w');
helper : String : false
一个CSS类,当调整元素大小时,将被添加到辅助元素中,一但调整结束则恢复正常。
初始:$('.selector').resizable({ helper: 'ui-state-highlight' }); 获取:var helper = $('.selector').resizable('option', 'helper'); 设置:$('.selector').resizable('option', 'helper', 'ui-state-highlight');
maxHeight : Integer : null
设置允许元素调整的最大高度。
初始:$('.selector').resizable({ maxHeight: 300 });
获取:var maxHeight = $('.selector').resizable('option', 'maxHeight');
设置:$('.selector').resizable('option', 'maxHeight', 300);
maxWidth : Integer : null
设置允许元素调整的最大宽度。
初始:$('.selector').resizable({ maxWidth: 250 });
获取:var maxWidth = $('.selector').resizable('option', 'maxWidth');
设置:$('.selector').resizable('option', 'maxWidth', 250);
minHeight : Integer : 10
设置允许元素调整的最小高度。
初始:$('.selector').resizable({ minHeight: 150 });
获取:var minHeight = $('.selector').resizable('option', 'minHeight');
设置:$('.selector').resizable('option', 'minHeight', 150);
minWidth : Integer : 10
设置允许元素调整的最小宽度。
初始:$('.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) { ... });
·方法
destory
从元素中移除拖拽功能。
用法:.droppable( 'destroy' )
disable
禁用元素的拖拽功能。
用法:.droppable( 'disable' )
enable
启用元素的拖拽功能。
用法:.droppable( 'enable' )
option
获取或设置元素的参数。
用法:.droppable( 'option' , optionName , [value] )
------------------------------------------------------------------------------------------------------------
- 概述
- resizable插件可以让选中的元素具有改变尺寸的功能。
- 官方示例地址:http://jqueryui.com/demos/resizable/
- 所有的事件回调函数都有两个参数:event和ui,浏览器自有event对象,和经过封装的ui对象
- ui.helper - 表示当前被改变尺寸的元素的JQuery对象
- ui.originalPosition - 表示未改变尺寸之前元素的位置{top,left}
- ui.originalSize - 表示未改变尺寸之前元素的大小{width,height}
- ui.position - 表示当前被改变尺寸的元素的坐标值对象{top,left}
- ui.size - 表示当前被改变尺寸的元素的大小值对象{width,height}
- ·参数(参数名 : 参数类型 : 默认值)
- alsoResize : Selector, jQuery, ElementDefault : false
- 当调整元素大小时,同步改变另一个(或一组)元素的大小。
- 初始:$('.selector').resizable({ alsoResize: '.other' });
- 获取:var alsoResize = $('.selector').resizable('option', 'alsoResize');
- 设置:$('.selector').resizable('option', 'alsoResize', '.other');
- animate : Boolean : false
- 在调整元素大小结束之后是否显示动画
- 初始:$('.selector').resizable({ animate: true });
- 获取:var animate = $('.selector').resizable('option', 'animate');
- 设置:$('.selector').resizable('option', 'animate', true);
- animateDuration : Integer, String : 'slow'
- 动画效果的持续时间。(单位:毫秒)可选值:'slow', 'normal', 'fast'
- 初始:$('.selector').resizable({ animateDuration: 500 });
- 获取:var animateDuration = $('.selector').resizable('option', 'animateDuration');
- 设置:$('.selector').resizable('option', 'animateDuration', 500);
- animateEasing : String : 'swing'
- 选择何种动画效果。
- 初始:$('.selector').resizable({ animateEasing: 'swing' });
- 获取:var animateEasing = $('.selector').resizable('option', 'animateEasing');
- 设置:$('.selector').resizable('option', 'animateEasing', 'swing');
- aspectRatio : Boolean, Float : false
- 如果设置为true,则元素的可调整尺寸受原来大小的限制。例如:9 / 16, or 0.5
- 初始:$('.selector').resizable({ aspectRatio: .75 });
- 获取:var aspectRatio = $('.selector').resizable('option', 'aspectRatio');
- 设置:$('.selector').resizable('option', 'aspectRatio', .75);
- autoHide : Boolean : false
- 如果设置为true,则默认隐藏掉可调整大小的手柄,除非鼠标移至元素上。
- 初始:$('.selector').resizable({ autoHide: true });
- 获取:var autoHide = $('.selector').resizable('option', 'autoHide');
- 设置:$('.selector').resizable('option', 'autoHide', true);
- cancel : Selector : ':input,option'
- 阻止resizable插件加载在与你匹配的元素上。
- 初始:$('.selector').resizable({ cancel: ':input,option' });
- 获取:var cancel = $('.selector').resizable('option', 'cancel');
- 设置:$('.selector').resizable('option', 'cancel', ':input,option');
- containment : String, Element, Selector : false
- 控制元素只能在某一个元素的大小之内改变。允许值:'parent', 'document', DOM元素, 或一个选择器.
- 初始:$('.selector').resizable({ containment: 'parent' });
- 获取:var containment = $('.selector').resizable('option', 'containment');
- 设置:$('.selector').resizable('option', 'containment', 'parent');
- delay : Integer : 0
- 以毫秒为单位,当发生鼠标点击手柄改变大小,延迟多少毫秒后才激活事件。
- 初始:$('.selector').resizable({ delay: 20 });
- 获取:var delay = $('.selector').resizable('option', 'delay');
- 设置:$('.selector').resizable('option', 'delay', 20);
- distance : Integer : 1
- 以像素为单位,当发生鼠标点击手柄改变大小,延迟多少像素后才激活事件。
- 初始:$('.selector').resizable({ distance: 20 });
- 获取:var distance = $('.selector').resizable('option', 'distance');
- 设置:$('.selector').resizable('option', 'distance', 20);
- ghost : Boolean : false
- 如果设置为true,则在调整元素大小时,有一个半透明的辅助对象显示。
- 初始:$('.selector').resizable({ ghost: true });
- 获取:var grid = $('.selector').resizable('option', 'ghost');
- 设置:$('.selector').resizable('option', 'ghost', true);
- grid : Array : false
- 设置元素调整的大小随网格变化,允许的数据为:{x,y}
- 初始:$('.selector').resizable({ grid: [50, 50] });
- 获取:var grid = $('.selector').resizable('option', 'grid');
- 设置:$('.selector').resizable('option', 'grid', [50, 50]);
- handles : String, Object : 'e, s, se'
- 设置resizable插件允许生成在元素的哪个边上,可选值:n, e, s, w, ne, se, sw, nw, all
- 初始:$('.selector').resizable({ handles: 'n, e, s, w' });
- 获取:var handles = $('.selector').resizable('option', 'handles');
- 设置:$('.selector').resizable('option', 'handles', 'n, e, s, w');
- helper : String : false
- 一个CSS类,当调整元素大小时,将被添加到辅助元素中,一但调整结束则恢复正常。
- 初始:$('.selector').resizable({ helper: 'ui-state-highlight' });
- 获取:var helper = $('.selector').resizable('option', 'helper');
- 设置:$('.selector').resizable('option', 'helper', 'ui-state-highlight');
- maxHeight : Integer : null
- 设置允许元素调整的最大高度。
- 初始:$('.selector').resizable({ maxHeight: 300 });
- 获取:var maxHeight = $('.selector').resizable('option', 'maxHeight');
- 设置:$('.selector').resizable('option', 'maxHeight', 300);
- maxWidth : Integer : null
- 设置允许元素调整的最大宽度。
- 初始:$('.selector').resizable({ maxWidth: 250 });
- 获取:var maxWidth = $('.selector').resizable('option', 'maxWidth');
- 设置:$('.selector').resizable('option', 'maxWidth', 250);
- minHeight : Integer : 10
- 设置允许元素调整的最小高度。
- 初始:$('.selector').resizable({ minHeight: 150 });
- 获取:var minHeight = $('.selector').resizable('option', 'minHeight');
- 设置:$('.selector').resizable('option', 'minHeight', 150);
- minWidth : Integer : 10
- 设置允许元素调整的最小宽度。
- 初始:$('.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) { ... });
- ·方法
- destory
- 从元素中移除拖拽功能。
- 用法:.droppable( 'destroy' )
- disable
- 禁用元素的拖拽功能。
- 用法:.droppable( 'disable' )
- enable
- 启用元素的拖拽功能。
- 用法:.droppable( 'enable' )
- option
- 获取或设置元素的参数。
- 用法:.droppable( 'option' , optionName , [value] )
JQuery UI - resizable的更多相关文章
- jQuery UI resizable使用注意事项、实时等比例拉伸及你不知道的技巧
这篇文章总结的是我在使用resizable插件的过程中,遇到的问题及变通应用的奇思妙想. 一.resizable使用注意事项 以下是我在jsfiddle上写的测试demo:http://jsfiddl ...
- JQuery UI - resizable调整区域大小
JQuery UI - resizable ·概述 resizable插件可以让选中的元素具有改变尺寸的功能. 官方示例地址:http://jqueryui.com/demos/resizable ...
- 解决 jQuery.UI.Resizable aspectRatio在init后无法重新设置
一.背景 在jQuery1.9.x版本之前,存在aspectRatio在Resizable方法init之后,无法再次修改aspectRatio的boolean值. 二.解决方案 // 用于fix j ...
- 【jQuery UI 1.8 The User Interface Library for jQuery】.学习笔记.6.Dialog控件
习惯上,我们播放一条简短的信息,或向浏览者询问一个问题,都会用到dialog. 创建一个基本的dialog 使用dialog 选项 形式 启用内置动画 给dialog添加按钮 使用dialog回调函数 ...
- jquery ui的css设计
jquery ui 是当前最强大的UI库之一,其两大卖点是对IE6的良好支持与换肤功能.为了构建avalon ui,今天起我将投入一部分精力来研究时下最流行的几个CSS框架.它是首当其冲. jquer ...
- jquery ui 怎么实现tab标签切换效果
1.效果图 2.HTML 代码 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> &l ...
- jQuery UI与jQuery easyUI的冲突解决办法
jQuery UI与jQuery easyUI都是基于jQuery开发的.难免里面会有些方法名冲突! 因此对jQuery.easyui其中的两个方法名:resizable 和 draggable进行替 ...
- Jquery UI
jQuery UI简介 jQuery UI包含了许多维持状态的小部件(Widget),因此,它与典型的 jQuery 插件使用模式略有不同.所有的 jQuery UI 小部件(Widget)使用相同的 ...
- JQuery UI dialog 弹窗实例及参数说明
按钮代码: <a id="suprise" style="margin-left: 0.5em;cursor:pointer;">点我会有惊喜< ...
随机推荐
- 长度为N的数组乱序存放着0带N-1.现在只能进行0与其他数的swap操作,请设计并实现排序,必须通过交换实现排序。
void sort(int* arr, int len) { if (!arr) { return; } for (int i = 1; i < len; ++i) { while (arr[0 ...
- 1.搜索引擎的历史,搜索引擎起步,发展,繁荣,搜索引擎的原理,搜索技术用途,信息检索过程,倒排索引,什么是Lucene,Lucene快速入门
一: 1 搜索引擎的历史 萌芽:Archie.Gopher Archie:搜索FTP服务器上的文件 Gopher:索引网页 2 起步:Robot(网络机器人)的出现与spider(网络爬虫) ...
- 04_关于元数据,ResultSetMetaData对象以及API方法介绍
ResultSetMetaData对象 元数据,可以理解为数据的数据 Jdbc中的元数据是指数据库.表.列的定义信息. ResultSetMetaData对象表示结果集ResultSet对象的元 ...
- Android简易实战教程--第十七话《自定义彩色环形进度条》
转载请注明出处:http://blog.csdn.net/qq_32059827/article/details/52203533 点击打开链接 在Android初级教程里面,介绍了shape用法 ...
- springMVC源码分析--容器初始化(一)ContextLoaderListener
在spring Web中,需要初始化IOC容器,用于存放我们注入的各种对象.当tomcat启动时首先会初始化一个web对应的IOC容器,用于初始化和注入各种我们在web运行过程中需要的对象.当tomc ...
- ROS_Kinetic_16 ubuntu中安装使用Matlab和ROS
ROS_Kinetic_16 ubuntu(16.04)中安装使用Matlab(2015b)和ROS(kinetic) 参考网址:http://cn.mathworks.com/hardware-su ...
- CUDA学习,环境配置和简单例子
根据摩尔定律,每18个月,硬件的速度翻一番.纵使CPU的主频会越来越高,但是其核数受到了极大的限制,目前来说,最多只有8个或者9个核.相比之下,GPU具有很大的优势,他有成千上万个核,能完成大规模的并 ...
- 【一天一道LeetCode】#65. Valid Number
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Validat ...
- mongoDB常见的查询索引(三)
1. _id索引 _id索引是绝大多数集合默认建立的索引 对于每个插入的数据,MongoDB会自动生成一条唯一的_id字段. 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
- Java实现栈之计算器
Java实现栈来做一个将中缀表达式转化为后缀表达式的程序,中缀表达式更符合我们的主观感受,后缀表达式更适合计算机的运算,下面直接上代码吧: package Character1; import jav ...