各种效果的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 版本自动生成文章摘要
Jul 23 Javascript
调用HttpHanlder的几种返回方式小结
Dec 20 Javascript
从零学JS之你需要了解的几本书
May 19 Javascript
escape编码与unescape解码汉字出现乱码的解决方法
Jul 02 Javascript
js实现字符串转日期格式的方法
May 20 Javascript
基于JavaScript实现移动端TAB触屏切换效果
Oct 20 Javascript
js实现select下拉框菜单
Dec 08 Javascript
最简单的tab切换实例代码
May 13 Javascript
JQuery页面随滚动条动态加载效果的简单实现(推荐)
Feb 08 Javascript
JS中使用 after 伪类清除浮动实例
Mar 01 Javascript
Vue.js bootstrap前端实现分页和排序
Mar 10 Javascript
Vue响应式原理详解
Apr 18 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
要会喝咖啡也要会知道咖啡豆
2021/03/03 咖啡文化
PHP生成UTF8文件的方法
2010/05/15 PHP
php读取csv数据保存到数组的方法
2015/01/03 PHP
PHP输出图像imagegif、imagejpeg与imagepng函数用法分析
2016/11/14 PHP
PHP+MySQL实现在线测试答题实例
2020/01/02 PHP
使一个函数作为另外一个函数的参数来运行的javascript代码
2007/08/13 Javascript
javascript cookie解码函数(兼容ff)
2008/03/17 Javascript
javascript中类的定义及其方式(《javascript高级程序设计》学习笔记)
2011/07/04 Javascript
30分钟就入门的正则表达式基础教程
2013/02/25 Javascript
给ListBox添加双击事件示例代码
2013/12/02 Javascript
快速解决jQuery与其他库冲突的方法介绍
2014/01/02 Javascript
解决Jquery鼠标经过不停滑动的问题
2014/03/03 Javascript
jQuery使用ajaxSubmit()提交表单示例
2014/04/04 Javascript
javascript动态生成树形菜单的方法
2015/11/14 Javascript
手机图片预览插件photoswipe.js使用总结
2016/08/25 Javascript
js date 格式化
2017/02/15 Javascript
vue分类筛选filter方法简单实例
2017/03/30 Javascript
JS正则表达式验证中文字符
2017/05/08 Javascript
js for终止循环 跳出多层循环
2018/10/04 Javascript
jquery插件开发模式实例详解
2019/07/20 jQuery
Angular 中使用 FineReport不显示报表直接打印预览
2019/08/21 Javascript
js实现轮播图特效
2020/05/28 Javascript
python冒泡排序算法的实现代码
2013/11/21 Python
python 数据生成excel导出(xlwt,wlsxwrite)代码实例
2019/08/23 Python
Django后台管理系统的图文使用教学
2020/01/20 Python
Python实现哲学家就餐问题实例代码
2020/11/09 Python
python爬虫线程池案例详解(梨视频短视频爬取)
2021/02/20 Python
ziaja齐叶雅官方海外旗舰店:来自波兰的天然护肤品牌
2017/01/02 全球购物
俄罗斯化妆品和香水网上商店:Iledebeaute
2019/01/03 全球购物
Delphi工程师笔试题
2013/09/21 面试题
服装设计专业毕业生推荐信
2013/11/09 职场文书
煤矿安全保证书
2015/02/27 职场文书
交通事故起诉书
2015/05/19 职场文书
单位考核鉴定意见
2015/06/05 职场文书
毛主席纪念堂观后感
2015/06/17 职场文书
CSS3实现指纹特效代码
2022/03/17 HTML / CSS