日期:2011/12/26
在线演示 本地下载
今天分享一款jQuery的UI插件 - Ninja UI, 这个插件使用jQuery本身的语法来开发界面元素,而且你不需要关注CSS样式相关设定,因为整个CSS样式都被直接写到了插件中,不过坏处是,你需要 在开发前就确定好CSS,同时目前提供俩个类型的主题。插件使用简单,如果你会写jQuery代码,使用起来得心应手,支持的组件不是特别多,不过比较实 用,整个类库非常小,可以考虑使用其中某些组件。
支持组件:
- 自动补齐 autocomplete
- 按钮 button
- 对话框 Dialog
- 抽屉层 drawer
- 图标 icon
- 菜单 menu
- 星级评级 Rating
- 滑动器选择 Slider
- 标签 Tabs
支持主题:
支持浏览器(HTML5浏览器):
- Chrome
- Safari
- Firefox
- Internet Explorer*
- Opera
注释:IE9不支持Gradients,IE6-8不支持透明背景及其圆角
如何使用?
倒入类库:
<script src="js/jquery-1.6.4.min.js"></script>
<script src="js/jquery.ninjaui.min.js"></script>
复制代码
在document加载完成之前来创建Ninja相关组件:
(function ($) {
...
$(document).ready(function () {
$('#tabs').append($tabs);
$('#city').append($autocompleteExample);
$('#usageButton').append($button);
$('#ava').append($slider);
$('#poli').append($policy);
});
}(jQuery));
复制代码
创建各种组件:
var $autocompleteExample = $.ninja.autocomplete({
placeholder: 'United States Cities'
}).values(function (event) {
$.ajax({
url: 'http://ws.geonames.org/searchJSON',
dataType: 'jsonp',
data: {
country: 'US',
featureClass: 'P',
fuzzy: 0,
maxRows: 10,
q: event.query
},
success: function (data) {
$autocompleteExample.list({
values: $.map(data.geonames, function (item) {
return {
html: item.name + ', ' + item.adminName1,
value: item.name + ', ' + item.adminCode1
};
}),
query: event.query
});
},
error: function (request, status, message) {
$.error(message);
}
});
});
$tabs = $.ninja.tabs({
values: [
{
html: '<div style="padding:5px">Full registration</div>',
select: function () {
$('#extra').fadeIn();
}
},
{
html: '<div style="padding:5px">Quick registration</div>',
select: function () {
$('#extra').fadeOut();
}
}
]
});
$policy = $.ninja.drawer({
html: '<div style="padding: 20px">Welcome to <a href="http://gbin1.com">gbin1.com</a>, please pay attention to our community polices. thanks!</div>',
value: 'GBin1 Policy',
select: true
});
var $dialog, $button = $.ninja.button({
html: '<div style="padding:5px">Register Now</div>'
}).select(function () {
$dialog.attach();
});
$dialog = $.ninja.dialog({
html: '<div style="padding: 50px">Congratulations! welcome to GBin1.com</div>'
}).detach(function () {
$button.deselect();
});
var
$slider = $.ninja.slider({
value: 1,
values: [
{
select: function(){
$('#avaimg').animate({width:'-=30px'});
}
},
{
select: function(){
$('#avaimg').animate({width:'100px'});
}
},
{
select: function(){
$('#avaimg').animate({width:'+=30px'});
}
}
]
});
复制代码
在将生成的组件添加到DOM中:
$(document).ready(function () {
$('#tabs').append($tabs);
$('#city').append($autocompleteExample);
$('#usageButton').append($button);
$('#ava').append($slider);
$('#poli').append($policy);
});
复制代码
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Ninja UI Registration Demo</title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Ninja UI Registration Demo" />
<meta name="keywords" content="jQuery UI, jQuery plugin, GBin1.com" />
<meta name="author" content="Terry li - GBin1.com" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/style.css" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="sitebody">
<header>
<nav>
<span id="tabs"></span>
</nav>
</header>
<section>
<h1>Ninja UI Registration Demo</h1>
<p id=""><label>Email:</label> <input type="text"></p>
<p id="pwd"><label>Password:</label> <input type="password"></p>
<div id="extra">
<p id="city"><label>City:</label></p>
<p id="ava"><label>Avatar size:</label></p>
<p id="avaimgwrap"><img id="avaimg" src="images/logo.png"></p>
<p id="poli"></p>
</div>
<p id="usageButton"></p>
</section>
<footer>
<p>copywrite 2011 by gbin1.com</p>
</foorer>
</div>
<script src="js/jquery-1.6.4.min.js"></script>
<script src="js/jquery.ninjaui.min.js"></script>
<script src="js/gbin1.js"></script>
</body>
</html>
复制代码
CSS样式
/* General Demo Style */
body{
background:#101010;
color: #333;
font-size: 14px;
padding: 0;
margin: 0;
}
h1{
font-size:25px;
font-weight: bold;
padding: 10px 0px 10px 5px;
margin: 0px;
color: #CCC;
}
*{
position: relative;
padding: 0;
margin: 0;
}
#sitebody{
height: 120%;
}
header{
width: 570px;
padding: 50px 5px 20px;
margin: 0px auto;
}
footer{
width: 560px;
padding: 20px 0px 450px;
margin: 0px auto;
}
section{
position:relative;
width: 560px;
margin: 0px auto;
padding: 15px 5px 25px;
border: 1px solid #444;
border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
background: #222;
height: 650px;
color: #666;
}
input {
margin: 10px 0;
width: 220px;
border: 1px solid #000000;
border-radius: 3px 3px 3px 3px;
-moz-border-radius: 3px 3px 3px 3px;
-webkit-border-radius: 3px 3px 3px 3px;
padding: 5px 17px 5px 5px;
}
label{
width: 100px;
display: block;
margin: 10px 0;
float: left;
padding: 5px 0;
}
#poli{
width:550px;
}
#ava span span{
padding-left: 90px;
}
#avaimg{
width: 100px;
}
#usageButton{
padding: 10px 5px;
}
clr{
clear: both;
}
section p{
padding: 5px;
float: left;
width: 100%;
}
分享到:
相关推荐
Note: the latest edition of this book is jQuery: Novice to Ninja: New Kicks And Tricks jQuery: Novice to Ninja is your fast track to mastering jQuery—the all-conquering JavaScript framework. Used by...
jQuery: Novice to Ninja will show you how to unleash the amazing power of jQuery. In this easy-to-follow guide, you'll master all the major tricks and techniques that jQuery offers-within hours.
Publisher:SitePoint Released: February 2010 Pages: 300 ISBN-13:978-0-9805768-5-6 ISBN-10 :0-9805768-5-7
jQuery: Novice to Ninja: New Kicks And Tricks (2nd Edition) is your fast track to mastering jQuery—the all-conquering JavaScript framework. Used by over half the world’s top 10,000 websites, jQuery ...
1.国产jQuery UI框架 (jUI) DWZ DWZ富客户端框架(jQuery RIA framework), 是中国人自己开发...2.jQuery的界面插件 Ninja UI jQuery 是一个非常优秀的 JavaScript 框架,而且还有相当多的插件。其中的一些UI插件也相当
JavaScript Novice to Ninja(2nd) 英文无水印pdf 第2版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请...
novice to ninja jquery source code
C++制作的小游戏,玩家通过上下左右方向键来控制Ninja的移动,上键即跳跃,下键即下翻,左右键可以向左右移动一些距离,但是松开后又会回到原来的位置。挺住7波即可通关。满血是100点,被攻击会掉血,不被攻击会持续...
jQuery Novice to Ninja
一本清晰原版的学习jQuery的英文版好书,非扫描版本
忍者形式日期选择器本地化在Ninja Forms中设置jQuery UI Datepicker的默认值jQuery UI Datepicker文档有关选项的完整列表,请参见。
jQuery的:新手到忍者是一种最佳实践jQuery的解决方案的编制,以满足具挑战性的JavaScript的问题。在这本问答式的jQuery书里,你会发现一个现成的解决方案,以帮助去到你的网页具有新鲜感。 内容包括: - 滚动,...
青龙2.12.1 最新版 ninja 余量0 不可用解决办法 https://blog.csdn.net/qq_34909804/article/details/124918932?spm=1001.2014.3001.5501 由于某些原因,需要升级到最新版本的青龙,但是发现ninja不可以用 ninja的...
Ninja OS是一个实时桌面GNU / Linux系统,旨在提高速度,并着重于媒体和Web 2.0工具。 它基于Arch Linux,具有易于使用但轻巧的XFCE桌面。 但是建议您至少有300mb的RAM才能至少使用NinjaOS。 要运行firefox,gimp或...
Android.bp编译提示ninja: error: unknown target ‘MODULES-IN-xxx’终极指南 前言 当我们通过Android.bp编译脚本构建App或者bin执行文件时,可能会莫名的提示ninja: error: unknown target ‘MODULES-IN-...
ironsoul.ninja:ninja: 使用构建托管 :hammer_and_wrench: 想在您的机器上运行吗? 克隆项目 git clone https://github.com/ironsoul0/ironsoul.ninja.git 安装依赖项 cd ironsoul.ninja yarn 启动开发服务器 ...
Ubuntu64位编译Android源码出错解决办法