各种效果的jquery ui(接口)介绍


Posted in Javascript onSeptember 17, 2008

基本的鼠标互动:
拖拽(drag and dropping)、排序(sorting)、选择(selecting)、缩放(resizing)

各种互动效果:
手风琴式的折叠菜单(accordions)、日历(date pickers)、对话框(dialogs)、滑动条(sliders)、表格排序(table sorters)、页签(tabs)、放大镜效果(magnifier)、阴影效果(shadow)

第一部分:鼠标交互
1.1 Draggables:拖拽
所需文件:
ui.mouse.js
ui.draggable.js
ui.draggable.ext.js

用法:文件载入后,可以拖拽class = "block"的层
$(document).ready(function(){
    $(".block").draggable();
});

draggable(options)可以跟很多选项
选项说明:http://docs.jquery.com/UI/Draggables/draggable#options
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/tests/draggable.html

1.2 Droppables
所需要文件,drag drop
ui.mouse.js
ui.draggable.js
ui.draggable.ext.js
ui.droppable.js
ui.droppable.ext.js
用法:
$(document).ready(function(){
    $(".block").draggable({helper: 'clone'});
$(".drop").droppable({
   accept: ".block",
   activeClass: 'droppable-active',
   hoverClass: 'droppable-hover',
   drop: function(ev, ui) {
       $(this).append("<br>Dropped!");
   }
});
});
选项说明:http://docs.jquery.com/UI/Droppables/droppable#options
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/tests/droppable.html

1.3 Sortables 排序
所需要的文件
jquery.dimensions.js
ui.mouse.js
ui.draggable.js
ui.droppable.js
ui.sortable.js
用法:
$(document).ready(function(){
    $("#myList").sortable({});
});
dimensions文档http://jquery.com/plugins/project/dimensions
选项说明:http://docs.jquery.com/UI/Sortables/sortable#options
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/demos/ui.sortable.html

1.4 Selectables 选择
所需要的文件
jquery.dimensions.js
ui.mouse.js
ui.draggable.js
ui.droppable.js
ui.selectable.js
用法:
$(document).ready(function(){
    $("#myList").selectable();
});
选项说明:http://docs.jquery.com/UI/Selectables/selectable#options
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/tests/selectable.html

1.5 Resizables改变大小
所需要的文件 ,此例子需要几个css文件
jquery.dimensions.js
ui.mouse.js
ui.resizable.js
用法:
$(document).ready(function(){
    $("#example").resizable();
});
CSS文件:http://dev.jquery.com/view/trunk/themes/flora/flora.all.css
选项说明:http://docs.jquery.com/UI/Resizables/resizable#options
选项实例:http://dev.jquery.com/view/trunk ... s/ui.resizable.html

第二部分:互动效果
2.1 Accordion 折叠菜单
所需要的文件:
ui.accordion.js
jquery.dimensions.js
用法:
$(document).ready(function(){
    $("#example").accordion();
});
CSS文件:http://dev.jquery.com/view/trunk/themes/flora/flora.all.css
选项说明:http://docs.jquery.com/UI/Accordion/accordion#options
选项实例:http://dev.jquery.com/view/trunk/plugins/accordion/?p=1.1.1
2.2 dialogs 对话框
所需要的文件:
jquery.dimensions.js
ui.dialog.js
ui.resizable.js
ui.mouse.js
ui.draggable.js

用法:
$(document).ready(function(){
    $("#example").dialog();
});
CSS文件:http://dev.jquery.com/view/trunk/themes/flora/flora.all.css
选项说明:http://docs.jquery.com/UI/Dialog/dialog#options
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/tests/dialog.html

2.3 sliders 滑动条
所需要的文件
jquery.dimensions.js
ui.mouse.js
ui.slider.js

用法:
$(document).ready(function(){
    $("#example").slider();
});

CSS文件:http://dev.jquery.com/view/trunk/themes/flora/flora.all.css
选项说明:http://docs.jquery.com/UI/Slider/slider#options
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/demos/ui.slider.html

2.4 Tablesorter表格排序
所需要的文件
ui.tablesorter.js

用法:
$(document).ready(function(){
    $("#example").tablesorter({sortList:[[0,0],[2,1]], widgets: ['zebra']});
});

CSS文件:http://dev.jquery.com/view/trunk/themes/flora/flora.all.css
选项说明:http://docs.jquery.com/Plugins/Tablesorter/tablesorter#options
选项实例:http://tablesorter.com/docs/#Demo

2.5 tabs页签(对IE支持不是很好)
所需要的文件
ui.tabs.js
用法:
$(document).ready(function(){
    $("#example > ul").tabs();
});
CSS文件:http://dev.jquery.com/view/trunk/themes/flora/flora.all.css
选项说明:http://docs.jquery.com/UI/Tabs/tabs#initialoptions
选项实例:http://dev.jquery.com/view/trunk/plugins/ui/tests/tabs.html
tabs ext http://stilbuero.de/jquery/tabs_3/rotate.html

第三部分:效果
3.1 Shadow 阴影
实例http://dev.jquery.com/view/trunk/plugins/ui/demos/ui.shadow.html
3.2 Magnifier 放大
实例http://dev.jquery.com/view/trunk/plugins/ui/demos/ui.magnifier.html

Javascript 相关文章推荐
网页javascript精华代码集
Jan 24 Javascript
jQuery Flash/MP3/Video多媒体插件
Jan 18 Javascript
基于Jquery的实现回车键Enter切换焦点
Sep 14 Javascript
js计算精度问题小结
Apr 22 Javascript
js检测判断日期大于多少天的方法
May 04 Javascript
javascript实现显示和隐藏div方法汇总
Aug 14 Javascript
jQuery动态移除和添加背景图片的方法详解
Mar 07 Javascript
详解vue.js的事件处理器v-on:click
Jun 27 Javascript
vue cli 3.x 项目部署到 github pages的方法
Apr 17 Javascript
使用webpack搭建pixi.js开发环境
Feb 12 Javascript
Vue中实现回车键切换焦点的方法
Feb 19 Javascript
Vue中使用JsonView来展示Json树的实例代码
Nov 16 Javascript
Prototype中dom对象方法汇总
Sep 17 #Javascript
Javascript 读后台cookie代码
Sep 15 #Javascript
javascript高亮效果的二种实现方法
Sep 14 #Javascript
jquery 必填项判断表单是否为空的方法
Sep 14 #Javascript
js直接编辑当前cookie的脚本
Sep 14 #Javascript
javascript一些不错的函数脚本代码
Sep 10 #Javascript
利用Ext Js生成动态树实例代码
Sep 08 #Javascript
You might like
为IP查询添加GOOGLE地图功能的代码
2010/08/08 PHP
php引用传值实例详解学习
2013/11/06 PHP
php专用数组排序类ArraySortUtil用法实例
2015/04/03 PHP
php对接java现实加签验签的实例
2016/11/25 PHP
php封装db类连接sqlite3数据库的方法实例
2017/12/19 PHP
Laravel框架在本地虚拟机快速安装的方法详解
2018/06/11 PHP
PhpSpreadsheet设置单元格常用操作汇总
2020/11/13 PHP
phpstorm最新激活码分享亲测phpstorm2020.2.3版可用
2020/11/22 PHP
php实现简单四则运算器
2020/11/29 PHP
斜45度寻路实现函数
2009/08/20 Javascript
JS如何将UTC格式时间转本地格式
2013/09/04 Javascript
asp.net刷新本页面的六种方法总结
2014/01/07 Javascript
原生js图片轮播效果实现代码
2016/10/19 Javascript
Bootstrap Table使用整理(二)
2017/06/09 Javascript
vue2 中如何实现动态表单增删改查实例
2017/06/09 Javascript
js实现数组内数据的上移和下移的实例
2017/11/14 Javascript
vue实现2048小游戏功能思路详解
2018/05/09 Javascript
微信小程序CSS3动画下拉菜单效果
2018/11/04 Javascript
js实现搜索栏效果
2018/11/16 Javascript
js实现无缝轮播图特效
2020/05/09 Javascript
[27:08]完美世界DOTA2联赛PWL S2 SZ vs Rebirth 第二场 11.21
2020/11/23 DOTA
Python中的lstrip()方法使用简介
2015/05/19 Python
python计算一个序列的平均值的方法
2015/07/11 Python
20个常用Python运维库和模块
2018/02/12 Python
Python中利用xpath解析HTML的方法
2018/05/14 Python
pycharm 取消默认的右击运行unittest的方法
2018/11/29 Python
Python中super函数用法实例分析
2019/03/18 Python
python Manager 之dict KeyError问题的解决
2019/12/21 Python
利用css3 translate完美实现表头固定效果
2017/02/28 HTML / CSS
高清屏下canvas重置尺寸引发的问题的解决
2019/10/14 HTML / CSS
Under Armour安德玛德国官网:美国高端运动科技品牌
2019/03/09 全球购物
师范学院毕业生求职信范文
2013/12/26 职场文书
2014升学宴答谢词
2014/01/26 职场文书
投资合作协议书
2014/04/17 职场文书
终止劳动合同通知书
2015/04/16 职场文书
浅谈Redis的事件驱动模型
2022/05/30 Redis