各种效果的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 相关文章推荐
电子商务网站上的常用的js放大镜效果
Dec 08 Javascript
JavaScript使用Prototype实现面向对象的方法
Apr 14 Javascript
详解JavaScript中常用的函数类型
Nov 18 Javascript
jQuery版本升级踩坑大全
Jan 12 Javascript
JS实现设置ff与ie元素绝对位置的方法
Mar 08 Javascript
jQuery实现移动端手机商城购物车功能
Sep 24 Javascript
js判断文件格式及大小的简单实例(必看)
Oct 11 Javascript
Bootstrap基本组件学习笔记之导航(10)
Dec 07 Javascript
深入理解Angularjs 脏值检测
Oct 12 Javascript
JS实现简单的抽奖转盘效果示例
Feb 16 Javascript
js DOM的事件常见操作实例详解
Dec 16 Javascript
借助云开发实现小程序短信验证码的发送
Jan 06 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
destoon实现不同会员组公司名称显示不同的颜色的方法
2014/08/22 PHP
php读取csv文件并输出的方法
2015/03/14 PHP
php实现json编码的方法
2015/07/30 PHP
让innerHTML的脚本也可以运行起来
2006/07/01 Javascript
Javascript打印网页部分内容的脚本
2008/11/17 Javascript
自己的js工具 Cookie 封装
2009/08/21 Javascript
分页栏的web标准实现
2011/11/01 Javascript
xml转json的js代码
2012/08/28 Javascript
JS操作iframe里的dom(实例讲解)
2014/01/29 Javascript
jquery动态改变form属性提交表单
2014/06/03 Javascript
javascript函数式编程程序员的工具集
2015/10/11 Javascript
angularjs在ng-repeat中使用ng-model遇到的问题
2016/01/21 Javascript
jQuery+css实现的时钟效果(兼容各浏览器)
2016/01/27 Javascript
基于javascript实现的快速排序
2016/12/02 Javascript
详解JavaScript中js对象与JSON格式字符串的相互转换
2017/02/14 Javascript
详解ElementUI之表单验证、数据绑定、路由跳转
2017/06/21 Javascript
微信小程序日历/日期选择插件使用方法详解
2018/12/28 Javascript
微信小程序图片右边加两行文字的代码
2020/04/23 Javascript
Angular5整合富文本编辑器TinyMCE的方法(汉化+上传)
2020/05/26 Javascript
js+for循环实现字符串自动转义的代码(把后面的字符替换前面的字符)
2020/12/24 Javascript
[00:27]DOTA2荣耀之路2:Patience from zhou!
2018/05/24 DOTA
[03:30]完美盛典趣味短片 CSGO2019年度名场面
2019/12/07 DOTA
[01:03:41]DOTA2-DPC中国联赛 正赛 Dynasty vs XG BO3 第三场 2月2日
2021/03/11 DOTA
Python基于回溯法解决01背包问题实例
2017/12/06 Python
Face++ API实现手势识别系统设计
2018/11/21 Python
运用Python的webbrowser实现定时打开特定网页
2019/02/21 Python
浅谈Django2.0 加xadmin踩的坑
2019/11/15 Python
PyCharm2020.1.1与Python3.7.7的安装教程图文详解
2020/08/07 Python
css3动画事件—webkitAnimationEnd与计时器time事件
2013/01/31 HTML / CSS
世界上最大的汽车共享网站:Zipcar
2017/01/14 全球购物
汉米尔顿手表官网:Hamilton
2020/09/13 全球购物
网吧消防安全制度
2014/01/28 职场文书
小学班主任评语
2014/12/29 职场文书
2016党校学习心得体会范文
2016/01/07 职场文书
致创业的您:这类人不适合餐饮创业
2019/08/19 职场文书
Node.js实现断点续传
2021/06/23 Javascript