jquery ui 文档使用总结
介绍jquery ui文档中的api如何使用
<!doctype html>
<html lang="us"><head>
<meta charset="utf-8">
<title>jQuery UI Example Page</title>
<link href="jquery-ui.css" rel="stylesheet">
<style>
#draggable { width: 150px; height: 150px; padding: 0.5em; }
#parent{width:400px;height:400px;border: 1px solid #66afe9;}
.toggler { width: 500px; height: 200px; position: relative; }
#button { padding: .5em 1em; text-decoration: none; }
#effect { width: 240px; padding: 1em; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
</style>
</head>
<body>
<!--draggable-->
<div id="parent">
<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>
</div>
<!--draggable-->
<!--dialog-->
<button id="opener">open the dialog</button>
<div id="dialog" title="Dialog Title">I‘m a dialog</div>
<!--dialog-->
<!--effect-->
<div class="toggler">
<div id="effect" class="ui-corner-all">
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede.
</div>
</div>
<button id="button" class="ui-state-default ui-corner-all">Run Effect</button>
<!--effect-->
<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.js"></script>
<script>
//interactions模块<draggable>
$(function() {
//参数的使用
$( "#draggable" ).draggable({containment:‘#parent‘,revert:true,revertDuration:1000});
//参数get和set的使用
$( "#draggable" ).draggable( "option", "axis", "y" );
var axis = $( "#draggable" ).draggable( "option", "axis" );
alert(axis);
//事件的使用
$( "#draggable" ).draggable({
stop: function( event, ui ) {
//方法的使用
$( "#draggable" ).draggable( "disable" );
}
});
//widgets模块options methods events
//参数使用
$( "#dialog" ).dialog({ autoOpen: true,buttons: [ { text: "Ok", click: function() { $( this ).dialog( "close" ); } } ]});
$( "#opener" ).click(function() {
//函数使用
$( "#dialog" ).dialog( "close" );
});
//事件使用
$( "#dialog" ).dialog({
close: function( event, ui ) {
alert("close");
},
//ui对象的使用,查看相应api的属性
drag: function(event,ui){
alert(ui.position.left);
}
});
//effect模块addClasss
$( "#button" ).click(function() {
//参数使用className duration easing complete
$( "#effect" ).addClass( "newClass", 1000,‘easeInCubic‘, callback );
});
//回调函数
function callback() {
setTimeout(function() {
$( "#effect" ).removeClass( "newClass" );
}, 1500 );
}
});
</script>
</body></html>
一篇文章关于jquery ui的总结 http://wenku.baidu.com/link?url=O1p4Fjh3gvhps9ImY4HVYf2PCyU4IueD6BqxtpoStks5_I1Dwn8I4fjPc2EGk6JClx0Fv1OG6m3Gjn-Eb0XgYTVhCAQWbqNRyA0f2c1uk7O
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。