Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

弹出层 第一阶段 #64

Open
wants to merge 194 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
ba80021
add GitHub.application
nimoc-copilot May 6, 2015
28fb8d9
其他源安装 github 无效
nimoc-copilot May 6, 2015
de611b6
github 离线安装包
nimoc-copilot May 7, 2015
3ae45c3
Merge pull request #4 from nimojs/master
May 7, 2015
82703a7
remove github.zip
2319103827 May 7, 2015
1659940
Merge pull request #5 from 2319103827/gh-pages
May 7, 2015
b4c19af
增加 fork PR说明
nimoc-copilot May 8, 2015
a3391ab
增加主版本提示
nimoc-copilot May 8, 2015
d663f38
添加xuexb谢亮的tab
xuexb May 8, 2015
d9852c7
Merge pull request #6 from xuexb/gh-pages
May 8, 2015
cbd9daa
完善 Tab 挑战说明
nimoc-copilot May 8, 2015
289f01e
Merge pull request #1 from nimojs/gh-pages
xuexb May 8, 2015
d8cc806
添加tab历程
xuexb May 8, 2015
d9d78c8
Merge pull request #7 from xuexb/gh-pages
May 8, 2015
cce4103
增加 Dialog 调整
nimoc-copilot May 10, 2015
68e2df8
删除技能最低要求
nimoc-copilot May 10, 2015
05cd523
.
nimoc-copilot May 10, 2015
d64ea8a
a
2319103827 May 11, 2015
5a74591
基于面向对象的选项卡组件
myadmin May 11, 2015
9c9c296
Merge pull request #10 from 2319103827/gh-pages
May 11, 2015
d7b5907
Merge pull request #11 from myadmin/patch-1
May 11, 2015
3210b0b
整理目录
nimoc-copilot May 11, 2015
484033d
My tab code 1
Jun 4, 2015
2284082
Merge pull request #12 from zmen/gh-pages
Jun 4, 2015
b5315ba
Redundant code fixed
Jun 5, 2015
c3bb80a
My Tab Code 2
Jun 5, 2015
7987cca
My Tab Code 3 to 5
Jun 5, 2015
e7e1cb2
Merge pull request #13 from zmen/gh-pages
Jun 5, 2015
f62ee22
Optimization of code
Jun 6, 2015
102fd4d
Merge pull request #14 from zmen/gh-pages
Jun 6, 2015
8a3f8ec
submit my Tab -- by coolzjy
coolzjy Jun 30, 2015
063cb9c
Merge pull request #17 from coolzjy/gh-pages
Jun 30, 2015
e794ba5
Merge pull request #2 from nimojs/gh-pages
xuexb Jun 30, 2015
6ecf12e
修复示例代码错误
Jun 30, 2015
2a4d3ba
Merge pull request #3 from nimojs/gh-pages
xuexb Jun 30, 2015
3ba1f8c
添加弹出层
xuexb Jun 30, 2015
b86902a
submit my Dialog -- by coolzjy
coolzjy Jul 4, 2015
84bfdfc
Merge pull request #18 from coolzjy/gh-pages
Jul 4, 2015
68380ba
Merge pull request #4 from nimojs/gh-pages
xuexb Jul 12, 2015
c5aa5d6
add dialog for @xuexb
xuexb Jul 12, 2015
b6d27e8
修改事件注销
xuexb Jul 12, 2015
af221fc
添加默认页面
xuexb Jul 12, 2015
e814129
Merge pull request #19 from xuexb/gh-pages
Jul 12, 2015
fc19560
add from iris dialog
fromIRIS Aug 1, 2015
136bd5f
done challenge
LiJinyao Aug 1, 2015
6794c84
delete idea profile
LiJinyao Aug 1, 2015
795d286
Merge pull request #21 from LiJinyao/gh-pages
Aug 1, 2015
961f77b
Merge pull request #20 from fromIRIS/gh-pages
Aug 1, 2015
0bb3fe9
finfish dialog challenge
LiJinyao Aug 2, 2015
272c142
Merge pull request #22 from LiJinyao/gh-pages
Aug 3, 2015
40c60fc
one
ColdXu Oct 20, 2015
929a44e
'one'
Oct 21, 2015
6a5f746
'1'
Oct 22, 2015
f0edfd4
tab-3 挑战
Oct 22, 2015
247ec31
tab-4 完成
Oct 22, 2015
3c6c983
tab-5 挑战
Oct 22, 2015
c2b7564
tab 面向对象
Oct 22, 2015
2fd756a
END
Oct 22, 2015
7607adc
Merge pull request #23 from ColdXu/gh-pages
Oct 22, 2015
2f884ca
noe
Oct 22, 2015
66308e8
添加一个缺少的冒号
JasinYip Oct 24, 2015
1c8465f
Merge pull request #24 from JasinYip/gh-pages
Oct 24, 2015
2922125
complete the first stage
scq000 Oct 27, 2015
d0342b4
complete the second stage of tab
scq000 Oct 27, 2015
ee0c8c2
Merge pull request #25 from scq000/gh-pages
Oct 27, 2015
41d9d18
complete the third stage of tab
scq000 Oct 27, 2015
7818f0e
set activeIndex default value
scq000 Oct 27, 2015
467f5fd
set activeTriggerClass
scq000 Oct 27, 2015
dafc1ec
add triggerType
scq000 Oct 27, 2015
ab91711
complete the first stage of dialog
scq000 Oct 29, 2015
441adfc
Merge pull request #26 from scq000/gh-pages
Oct 29, 2015
2218476
My tab code
Nov 3, 2015
2b18d72
Merge pull request #27 from limingyang2012/gh-pages
Nov 3, 2015
a287f6b
my dialog
Nov 4, 2015
7583677
Merge pull request #28 from limingyang2012/gh-pages
Nov 4, 2015
c240eb8
'2'
ColdXu Nov 6, 2015
e801af0
'2'
ColdXu Nov 6, 2015
7050c89
complete the second stage of dialog
scq000 Nov 8, 2015
67505ea
complete the third stage of dialog
scq000 Nov 8, 2015
1587a18
complete the fourth stage of dialog
scq000 Nov 8, 2015
1a5dbc9
Merge pull request #29 from scq000/gh-pages
Nov 8, 2015
b3152f1
'2'
ColdXu Nov 9, 2015
a49cd06
'2'
ColdXu Nov 9, 2015
91930fb
'2'
ColdXu Nov 9, 2015
3be7ade
'2'
ColdXu Nov 9, 2015
41795c8
'2'
ColdXu Nov 9, 2015
53ae526
Merge pull request #30 from ColdXu/gh-pages
Nov 9, 2015
c7624f6
tab1
Yeahax Nov 19, 2015
9684502
Merge pull request #31 from Yeahax/gh-pages
Nov 19, 2015
94c4c77
tab 1-5 阶段完成
52cik Nov 25, 2015
2d49323
Merge pull request #34 from 52cik/gh-pages
Nov 25, 2015
c563e07
dialog 1-4 阶段完成
52cik Nov 26, 2015
c239e76
Merge pull request #35 from 52cik/gh-pages
Nov 26, 2015
ad83996
my tab code 1
murphywuwu Dec 11, 2015
1ac99d8
Create .gitignore
Dec 12, 2015
edfc4af
delete .idea
murphywuwu Dec 12, 2015
37ffd1a
Merge pull request #36 from murphywuwu/gh-pages
Dec 12, 2015
f99db11
my tab code 2
murphywuwu Dec 14, 2015
c71f5f1
my tab code 2
murphywuwu Dec 14, 2015
c498664
my tab code 2
murphywuwu Dec 14, 2015
660a466
add semicolon in javascript
murphywuwu Dec 15, 2015
332c28c
Merge pull request #37 from murphywuwu/gh-pages
Dec 15, 2015
0be4be4
my tab code 3
murphywuwu Dec 15, 2015
9125c3f
modified activeClass in js
murphywuwu Dec 15, 2015
cfeeb7a
delete comma
murphywuwu Dec 15, 2015
0c37cd9
modified activeIndex in js
murphywuwu Dec 15, 2015
c0771ad
Merge pull request #38 from murphywuwu/gh-pages
Dec 16, 2015
355ac05
my tab code 4
murphywuwu Dec 16, 2015
5c13667
format finishing
murphywuwu Dec 16, 2015
e49b327
1/index.js @file modified
murphywuwu Dec 16, 2015
1a97a07
Merge pull request #39 from murphywuwu/gh-pages
Dec 17, 2015
aa9aa1e
my tab code 5
murphywuwu Dec 17, 2015
5fc9b50
Merge pull request #40 from murphywuwu/gh-pages
Dec 17, 2015
ef25113
my dialog code 1
murphywuwu Dec 17, 2015
2700345
modified title in html
murphywuwu Dec 17, 2015
8e93e28
Merge pull request #41 from murphywuwu/gh-pages
Dec 17, 2015
a591a3b
Update index.html
Dec 17, 2015
4132351
my dialog code 1
murphywuwu Dec 21, 2015
57b9883
modified jquery path
murphywuwu Dec 21, 2015
b61f03a
my dialog code 2
murphywuwu Dec 22, 2015
c9ca07a
第二阶段
Yeahax Dec 23, 2015
efd17a7
Merge pull request #43 from Yeahax/gh-pages
Dec 23, 2015
f75297b
my dialog code 3
murphywuwu Dec 24, 2015
5ad6580
my dialog code 4
murphywuwu Dec 24, 2015
b298751
update change
murphywuwu Dec 24, 2015
3f8d5fe
conflict restore
murphywuwu Dec 24, 2015
03eafbb
#44
Dec 24, 2015
1992845
Merge pull request #45 from nimojs/murphywuwu-gh-pages
Dec 26, 2015
067fab3
选项卡 第一阶段
newraina Jan 6, 2016
03b4a6a
修改部分文字
newraina Jan 6, 2016
1c86e8b
Merge pull request #46 from newraina/gh-pages
Jan 6, 2016
896e4bd
选项卡 第二阶段
newraina Jan 6, 2016
94189b0
Merge pull request #47 from newraina/gh-pages
Jan 6, 2016
316c871
选项卡 第三阶段
newraina Jan 6, 2016
527128c
增加新的参数
newraina Jan 6, 2016
209021f
Merge pull request #48 from newraina/gh-pages
Jan 6, 2016
febdcd4
选项卡 第四阶段
newraina Jan 7, 2016
bd6763e
选项卡 第五阶段
newraina Jan 7, 2016
aacd8ca
修正
newraina Jan 7, 2016
39bd06f
Merge pull request #49 from newraina/gh-pages
Jan 7, 2016
3defac0
选项卡 第六阶段
newraina Jan 8, 2016
ece5283
Merge pull request #50 from newraina/gh-pages
Jan 8, 2016
a8e57ce
Dialog弹出层 初始化
newraina Jan 9, 2016
5de978e
Dialog弹出层 第一阶段
newraina Jan 10, 2016
aa695f5
Dialog弹出层 第二阶段
newraina Jan 10, 2016
9a87e32
Dialog弹出层 第三阶段
newraina Jan 10, 2016
1b7f77e
Dialog弹出层 第四阶段
newraina Jan 10, 2016
2eb40cd
Merge pull request #51 from newraina/gh-pages
Jan 11, 2016
b85416c
Dialog弹出层 第五阶段
newraina Jan 13, 2016
f82104b
Merge pull request #52 from newraina/gh-pages
Jan 13, 2016
cc28a0c
add rccoder tab1
rccoder Jan 13, 2016
dbcc2d6
add rccoder tab2
rccoder Jan 13, 2016
46da836
add rccoder tab3
rccoder Jan 13, 2016
16b0d22
fix rccoder tab3 and add tab4
rccoder Jan 13, 2016
fd3c346
fix rccoder tab4 and add tab5
rccoder Jan 13, 2016
bd464d2
add rccoder README.md
rccoder Jan 13, 2016
756be2b
Merge pull request #53 from rccoder/gh-pages
Jan 13, 2016
4e8bf81
593273894的Tab选项卡
593273894 Jan 14, 2016
ed9fa94
Merge pull request #54 from 593273894/gh-pages
Jan 15, 2016
3515017
完成 tab 阶段五
DuXingXia233 Mar 3, 2016
2cf4259
Merge pull request #55 from DuXingXia233/gh-pages
Mar 3, 2016
9dc03d6
完成
cuzzeg Mar 19, 2016
de4e19b
修改单词拼写错误
cuzzeg Mar 19, 2016
b4499d3
Merge pull request #56 from Veena233/gh-pages
Mar 19, 2016
dba9890
learn-js by whatlife.
whatlife Apr 15, 2016
b2f873c
Merge pull request #57 from whatlife/gh-pages
Apr 16, 2016
66e2a31
My tab code 1
May 4, 2016
83b275c
My code tab 2
May 4, 2016
367d7e4
Merge pull request #58 from langrren/gh-pages
May 15, 2016
5040846
fanplus
fanzihui Sep 7, 2016
7f1684c
dialog 4
fanzihui Sep 7, 2016
4cd5dd8
dialog 4
fanzihui Sep 7, 2016
6808d5e
dialog 4
fanzihui Sep 7, 2016
e1264a7
Merge pull request #59 from fanzihui/gh-pages
Sep 8, 2016
00aeffb
修改index.js,style.css
fanzihui Sep 10, 2016
7dd56ba
添加注释
fanzihui Sep 10, 2016
b5b1209
dialog确定回调,修复dialog不出现时按键问题
fanzihui Sep 17, 2016
284e9b9
修复按键关闭时行为
fanzihui Sep 17, 2016
2d0c2f1
Merge pull request #60 from fanzihui/gh-pages
Sep 18, 2016
8ed9b72
粗糙完成第一阶段
LastGun Sep 19, 2016
568ac46
完成了第二阶段
LastGun Sep 19, 2016
c8f813f
第三阶段前期
LastGun Sep 19, 2016
6b09d57
第一阶段小试
LastGun Sep 19, 2016
4b84b56
第一阶段小试
LastGun Sep 19, 2016
091d5b0
Merge remote-tracking branch 'origin/gh-pages' into gh-pages
LastGun Sep 20, 2016
dc088f5
第三阶段完成
LastGun Sep 20, 2016
8e0d414
第四阶段完成
LastGun Sep 20, 2016
904ade5
修改部分样式
LastGun Sep 20, 2016
e7e8bc6
修复了样式
LastGun Sep 20, 2016
8cab73e
修复了第一阶段的样式,粗略完成第二阶段
LastGun Sep 20, 2016
31b7c3f
完成Tab组件第三阶段
LastGun Sep 20, 2016
93c33df
完成Tab组件第四阶段,但hover没反应,明天修复bug
LastGun Sep 20, 2016
e4af775
优化了第四阶段,完成了第五阶段
LastGun Sep 21, 2016
f88e70f
Merge pull request #61 from LastGun/gh-pages
Mar 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

.idea
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
# learn-js


**请确认你访问的是主版本 [nimojs/learn-js](https://github.com/nimojs/learn-js),在主版本中你可以看到所有人的代码提交**

---

这是一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。

组件开发的挑战是循序渐渐的,每个组件开发挑战都必须掌握必要的知识才可以接受。
组件开发的挑战是循序渐进的,每个组件开发挑战都必须掌握必要的知识才可以接受。

> 点击右上角的 **[Watch](https://github.com/nimojs/learn-js/subscription)** 关注本项目,点击 Star 收藏本项目。
>

---

**参与方式:**
选择挑战某个组件开发,按阶段完成任务。将自己的代码提交到对应组件中。

[Fork & Pull Requests](fork&pullrequests.md)
[Fork & Pull Requests | 克隆与请求合并](fork&pullrequests.md)

## Tab 选项卡

<a href="package/tab/"><img src="package/tab/tab.png" ></a>

### 技能最低要求

1. 熟悉 jQuery

[接受挑战](package/tab/)

## Dialog 弹出层

<a href="package/dialog/"><img src="package/dialog/dialog.png" ></a>

[接受挑战](package/dialog/)
73 changes: 68 additions & 5 deletions fork&pullrequests.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,72 @@
# 克隆与请求合并

## 注册 GitHub 账号

1. Fork 此项目
2. 使用 GitHub 客户端 Clone 此项目
3. 编写代码
4. 提交代码
5. 发送合并请求
[https://github.com/join](https://github.com/join)

## Fork 此项目

[https://github.com/nimojs/learn-js](https://github.com/nimojs/learn-js)

![fork](https://cloud.githubusercontent.com/assets/3949015/7487787/31a3645a-f3f1-11e4-85d8-e9fe041db782.png)

## 安装 GitHub 客户端

下载 [GitHub Windows 离线安装包](http://static.nimojs.com/file/github/github-windows7.zip)

解压缩后打开 GitHub.exe

![](https://cloud.githubusercontent.com/assets/3949015/7514594/6a6dea84-f4f1-11e4-9530-1f89eed33c29.png)


## Clone 代码到本地

![](https://cloud.githubusercontent.com/assets/3949015/7514669/1bd3e22e-f4f2-11e4-9d4a-4668f59db31c.png)


## 编写代码

![](https://cloud.githubusercontent.com/assets/3949015/7514699/60066232-f4f2-11e4-9e98-9cedaa67ae46.png)

在你所挑战的组件目录下的 `code` 文件夹创建你的 GitHub 用户名文件夹和对应挑战的阶段。如:

```
└── package/
└── tab
└── code
└── 2319103827 // 你的 GitHub 用户名
└── 1 // 第一阶段代码
└── index.html
```

## 提交代码

在 GitHub 中双击项目

![](https://cloud.githubusercontent.com/assets/3949015/7514735/b5105670-f4f2-11e4-9c6c-a8703830f675.png)

填写提交说明

![](https://cloud.githubusercontent.com/assets/3949015/7514821/c5d9812e-f4f3-11e4-962f-f91d150f77c2.png)

点击 COMMIT 按钮

同步代码

![](https://cloud.githubusercontent.com/assets/3949015/7514793/61c16378-f4f3-11e4-9c33-a51b20f97cd4.png)

## 请求合并代码至 [nimojs/learn-js](https://github.com/nimojs/learn-js/pulls)

打开 `https://github.com/你的用户名/learn-js/`

点击 Pull Requset

![image](https://cloud.githubusercontent.com/assets/3949015/7514891/73cd9f2c-f4f4-11e4-871c-7213b761ad4f.png)

点击 Create pull request

![image](https://cloud.githubusercontent.com/assets/3949015/7514934/ed1ae20e-f4f4-11e4-9d9b-3da335b2588e.png)

nimojs/learn-js 维护者收到 PR 后会合并你的请求。

最终你的代码会显示在 [https://github.com/nimojs/learn-js/blob/gh-pages/package/tab/code/2319103827/1/index.html](https://github.com/nimojs/learn-js/blob/gh-pages/package/tab/code/2319103827/1/index.html)
75 changes: 75 additions & 0 deletions package/dialog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Dialog 弹出层

<img src="dialog.png" >

## 阶段 1

实现上图 JS 效果,CSS样式随意。弹出层要水平垂直居中在屏幕中

## 阶段 2

封装成一个 `dialog` 函数,提供如下 api :

**trigger**

对话框触发元素,可传递选择器。

**content**

容器的内容,可以是纯字符串、dom对象、jQuery对象、html标签字符串。


```js
dialog({
trigger: '#btn',
content: '<strong>哈哈</strong>'
})
```

```html
<button type="button" id="btn">Click me</button>
```

点击 Click me 弹出 **哈哈**

可通过参数指定父级DOM、触发DOM、内容DOM。

## 阶段3
可控制显示和关闭的动画效果

```js
dialog({
trigger: '#btn',
content: '<strong>哈哈</strong>',
effectShow: function ($element) {
// 淡入显示
$element.fadeIn(500)
},
effectHide: function ($element) {
// 淡出显示
$element.fadeOut(500)
}
})
```

## 阶段 4
添加点击关闭时触发的函数,并支持使用键盘 <kbd>ESC</kbd> 键关闭弹出层

```js
dialog({
trigger: '#btn',
content: '<strong>哈哈</strong>',
onClose: function (element) {
/*
element 弹出层 DOM 元素
*/
}
})
```
## 完成挑战

添加关闭事件

还有更多 API 可以实现,但以上四个阶段已经足够提高你 Dialog 类型组件开发的经验。

如果你将以上所有阶段都完成了, Dialog 的挑战就结束了。但我们希望你继续完善这个组件增加更多的 API。
47 changes: 47 additions & 0 deletions package/dialog/code/52cik/1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>dialog 阶段一</title>
<style>
*{margin:0;padding:0;font-size:12px;}

.dialog {display:none;}
.dialog .mask{position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.8);}
.dialog .box{position:fixed;top:0;right:0;bottom:0;left:0;margin:auto;width:500px;height:160px;background-color:#fff;}
.dialog .box .title{padding:0 1em;height:40px;border-bottom:1px solid #ddd;background-color:#eee;font-size:14px;line-height:40px;}
.dialog .box .content{padding:1em;}
.dialog .box .close{position:absolute;top:0;right:0;display:block;width:2em;text-align:center;font-weight:700;font-size:20px; line-height:40px;cursor:pointer;}

#btn {display:block;margin:10px auto;padding:.5em 1em;}
</style>
</head>
<body>

<button id="btn"> 点我 </button>

<div class="dialog">
<div class="mask"></div>
<div class="box">
<div class="title">我是标题</div>
<div class="content">我是内容 我是内容</div>
<span class="close">&#215;</span>
</div>
</div>

<script src="https://dn-cdnjsnet.qbox.me/jquery/1.10.2/jquery.js"></script>
<script>
(function () {
var $dialog = $('.dialog');

$('#btn').on('click', function () {
$dialog.fadeIn();
});

$dialog.on('click', '.close', function () {
$dialog.fadeOut();
});
})();
</script>
</body>
</html>
63 changes: 63 additions & 0 deletions package/dialog/code/52cik/2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>dialog 阶段二</title>
<style>
*{margin:0;padding:0;font-size:12px;}

.dialog {display:none;}
.dialog .mask{position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.8);}
.dialog .box{position:fixed;top:0;right:0;bottom:0;left:0;margin:auto;width:500px;height:160px;background-color:#fff;}
.dialog .box .title{padding:0 1em;height:40px;border-bottom:1px solid #ddd;background-color:#eee;font-size:14px;line-height:40px;}
.dialog .box .content{padding:1em;}
.dialog .box .close{position:absolute;top:0;right:0;display:block;width:2em;text-align:center;font-weight:700;font-size:20px; line-height:40px;cursor:pointer;}

.btn {display:block;margin:10px auto;padding:.5em 1em;}
</style>
</head>
<body>

<button id="btn" class="btn"> 点我 </button>

<div class="dialog">
<div class="mask"></div>
<div class="box">
<div class="title"></div>
<div class="content"></div>
<span class="close">&#215;</span>
</div>
</div>

<script src="https://dn-cdnjsnet.qbox.me/jquery/1.10.2/jquery.js"></script>
<script>
function dialog (opts) {
var opt = $.extend({
trigger: '#btn',
title: '标题',
content: '内容'
}, opts || {});


var $dialog = $('.dialog');
$('.title', $dialog).html(opt.title);
$('.content', $dialog).html(opt.content);

$(opt.trigger).on('click', function () {
$dialog.fadeIn();
});

$dialog.on('click', '.close', function () {
$dialog.fadeOut();
});
}

dialog({
trigger: '#btn',
title: '呵呵',
content: '<b>哈哈哈哈</b>'
});

</script>
</body>
</html>
Loading