├── .gitignore
├── README.md
├── fork&pullrequests.md
├── package
├── dialog
│ ├── README.md
│ ├── code
│ │ ├── 52cik
│ │ │ ├── 1.html
│ │ │ ├── 2.html
│ │ │ ├── 3.html
│ │ │ └── 4.html
│ │ ├── ColdXu
│ │ │ ├── 1.html
│ │ │ ├── 2.html
│ │ │ ├── 3.html
│ │ │ └── 4.html
│ │ ├── LastGun
│ │ │ ├── dialog-stage-1
│ │ │ │ ├── dialog.html
│ │ │ │ └── dialog.js
│ │ │ ├── dialog-stage-2
│ │ │ │ ├── dialog.html
│ │ │ │ └── dialog.js
│ │ │ ├── dialog-stage-3
│ │ │ │ ├── dialog.html
│ │ │ │ └── dialog.js
│ │ │ └── dialog-stage-4
│ │ │ │ ├── dialog.html
│ │ │ │ └── dialog.js
│ │ ├── coolzjy
│ │ │ ├── dialog.css
│ │ │ ├── dialog.js
│ │ │ └── index.html
│ │ ├── fanplus
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── fromiris
│ │ │ ├── close.png
│ │ │ ├── css
│ │ │ │ └── dialog.css
│ │ │ ├── dialog.html
│ │ │ ├── dialog.js
│ │ │ └── dialog.less
│ │ ├── lijinyao
│ │ │ ├── close.png
│ │ │ ├── dialog-stage1
│ │ │ │ ├── index.html
│ │ │ │ └── script.js
│ │ │ ├── dialog-stage2
│ │ │ │ ├── index.html
│ │ │ │ └── script.js
│ │ │ ├── dialog-stage3
│ │ │ │ ├── index.html
│ │ │ │ └── script.js
│ │ │ ├── dialog-stage4
│ │ │ │ ├── index.html
│ │ │ │ └── script.js
│ │ │ └── style.css
│ │ ├── limingyang2012
│ │ │ ├── 阶段一
│ │ │ │ ├── css
│ │ │ │ │ └── main.css
│ │ │ │ ├── index.html
│ │ │ │ └── js
│ │ │ │ │ └── main.js
│ │ │ ├── 阶段三
│ │ │ │ ├── css
│ │ │ │ │ └── main.css
│ │ │ │ ├── index.html
│ │ │ │ └── js
│ │ │ │ │ ├── jquery.min.js
│ │ │ │ │ └── main.js
│ │ │ ├── 阶段二
│ │ │ │ ├── css
│ │ │ │ │ └── main.css
│ │ │ │ ├── index.html
│ │ │ │ └── js
│ │ │ │ │ └── main.js
│ │ │ └── 阶段四
│ │ │ │ ├── css
│ │ │ │ └── main.css
│ │ │ │ ├── index.html
│ │ │ │ └── js
│ │ │ │ ├── jquery.min.js
│ │ │ │ └── main.js
│ │ ├── murphywuwu
│ │ │ ├── 1
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── style.css
│ │ │ ├── 2
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── style.css
│ │ │ ├── 3
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── style.css
│ │ │ └── 4
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── style.css
│ │ ├── newraina
│ │ │ ├── 2
│ │ │ │ ├── index.html
│ │ │ │ ├── main.js
│ │ │ │ └── style.css
│ │ │ ├── 3
│ │ │ │ ├── index.html
│ │ │ │ ├── main.js
│ │ │ │ └── style.css
│ │ │ ├── 4
│ │ │ │ ├── index.html
│ │ │ │ ├── main.js
│ │ │ │ └── style.css
│ │ │ ├── 5
│ │ │ │ ├── index.html
│ │ │ │ ├── main.js
│ │ │ │ └── style.css
│ │ │ └── 1.html
│ │ ├── scq000
│ │ │ ├── 1
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── styles.css
│ │ │ ├── 2
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── styles.css
│ │ │ ├── 3
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── styles.css
│ │ │ └── 4
│ │ │ │ ├── index.html
│ │ │ │ ├── index.js
│ │ │ │ └── styles.css
│ │ ├── veena233
│ │ │ └── index5.html
│ │ └── xuexb
│ │ │ ├── 1
│ │ │ └── index.html
│ │ │ ├── 2
│ │ │ └── index.html
│ │ │ ├── 3
│ │ │ └── index.html
│ │ │ ├── 4
│ │ │ └── index.html
│ │ │ ├── README.md
│ │ │ └── mod
│ │ │ ├── close.png
│ │ │ ├── close@2x.png
│ │ │ └── dialog.css
│ └── dialog.png
└── tab
│ ├── README.md
│ ├── code
│ ├── 593273894
│ │ ├── 1
│ │ │ └── index.html
│ │ ├── 2
│ │ │ └── index.html
│ │ ├── 3
│ │ │ └── index.html
│ │ ├── 4
│ │ │ └── index.html
│ │ └── 5
│ │ │ └── index.html
│ ├── 2319103827
│ │ ├── index.html
│ │ ├── index2.html
│ │ ├── index3.html
│ │ ├── index4.html
│ │ └── index5.html
│ ├── 52cik
│ │ ├── 1.html
│ │ ├── 2.html
│ │ ├── 3.html
│ │ ├── 4.html
│ │ └── 5.html
│ ├── ColdXu
│ │ ├── 1.html
│ │ ├── 2.html
│ │ ├── 3.html
│ │ ├── 4.html
│ │ └── 5.html
│ ├── DuXingXia233
│ │ ├── README.md
│ │ ├── css
│ │ │ ├── tab.css
│ │ │ └── yahoo reSet.css
│ │ ├── img
│ │ │ ├── 1.png
│ │ │ ├── 2.png
│ │ │ ├── 3.png
│ │ │ ├── 4.png
│ │ │ ├── 5.png
│ │ │ ├── 6.png
│ │ │ ├── 7.png
│ │ │ └── 8.png
│ │ ├── js
│ │ │ ├── common.js
│ │ │ └── tab.js
│ │ └── tab.html
│ ├── LastGun
│ │ ├── stage-1
│ │ │ ├── tab-1.html
│ │ │ └── tab.js
│ │ ├── stage-2
│ │ │ ├── tab.html
│ │ │ └── tab.js
│ │ ├── stage-3
│ │ │ ├── tab.html
│ │ │ └── tab.js
│ │ ├── stage-4
│ │ │ ├── tab.html
│ │ │ └── tab.js
│ │ └── stage-5
│ │ │ ├── tab.html
│ │ │ └── tab.js
│ ├── Yeahax
│ │ ├── 1
│ │ │ └── index.html
│ │ └── 2
│ │ │ └── index.html
│ ├── coolzjy
│ │ ├── index.html
│ │ ├── script.js
│ │ └── style.css
│ ├── langrren
│ │ ├── 1
│ │ │ └── index.html
│ │ └── 2
│ │ │ └── index.html
│ ├── lijinyao
│ │ ├── style.css
│ │ ├── tab-stage1
│ │ │ ├── idnex.html
│ │ │ └── script.js
│ │ ├── tab-stage2
│ │ │ ├── idnex.html
│ │ │ └── script.js
│ │ ├── tab-stage3
│ │ │ ├── idnex.html
│ │ │ └── script.js
│ │ └── tab-stage4
│ │ │ ├── idnex.html
│ │ │ └── script.js
│ ├── limingyang2012
│ │ ├── 阶段一
│ │ │ ├── css
│ │ │ │ └── main.css
│ │ │ ├── index.html
│ │ │ └── js
│ │ │ │ └── main.js
│ │ ├── 阶段三
│ │ │ ├── css
│ │ │ │ └── main.css
│ │ │ ├── index.html
│ │ │ └── js
│ │ │ │ └── main.js
│ │ ├── 阶段二
│ │ │ ├── css
│ │ │ │ └── main.css
│ │ │ ├── index.html
│ │ │ └── js
│ │ │ │ └── main.js
│ │ ├── 阶段五
│ │ │ ├── css
│ │ │ │ └── main.css
│ │ │ ├── index.html
│ │ │ └── js
│ │ │ │ └── main.js
│ │ └── 阶段四
│ │ │ ├── css
│ │ │ └── main.css
│ │ │ ├── index.html
│ │ │ └── js
│ │ │ └── main.js
│ ├── murphywuwu
│ │ ├── 1
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── 2
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── 3
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── 4
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ └── 5
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ ├── myadmin
│ │ └── index.html
│ ├── newraina
│ │ ├── 1.html
│ │ ├── 2.html
│ │ ├── 3.html
│ │ ├── 4.html
│ │ ├── 5.html
│ │ └── 6.html
│ ├── rccoder
│ │ ├── README.md
│ │ ├── tab1.html
│ │ ├── tab2.html
│ │ ├── tab3.html
│ │ ├── tab4.html
│ │ └── tab5.html
│ ├── scq000
│ │ ├── 1
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── 2
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── 3
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ └── 4
│ │ │ ├── index.html
│ │ │ ├── index.js
│ │ │ └── style.css
│ ├── veena233
│ │ ├── index1.html
│ │ ├── index2.html
│ │ └── index5.html
│ ├── whatlife
│ │ ├── 1.html
│ │ ├── 2.html
│ │ ├── 3.html
│ │ ├── 4.html
│ │ └── 5.html
│ ├── xuexb
│ │ ├── 1
│ │ │ └── index.html
│ │ ├── 2
│ │ │ └── index.html
│ │ ├── 3
│ │ │ └── index.html
│ │ ├── 4
│ │ │ └── index.html
│ │ ├── 5
│ │ │ └── index.html
│ │ └── README.md
│ └── zmen
│ │ ├── 1.html
│ │ ├── 2.html
│ │ ├── 3.html
│ │ ├── 4.html
│ │ └── 5.html
│ └── tab.png
└── static
└── jquery
└── 1.11.2
├── jquery.js
├── jquery.min.js
└── jquery.min.map
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 |
10 | # Directory for instrumented libs generated by jscoverage/JSCover
11 | lib-cov
12 |
13 | # Coverage directory used by tools like istanbul
14 | coverage
15 |
16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17 | .grunt
18 |
19 | # node-waf configuration
20 | .lock-wscript
21 |
22 | # Compiled binary addons (http://nodejs.org/api/addons.html)
23 | build/Release
24 |
25 | # Dependency directory
26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27 | node_modules
28 |
29 | .idea
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # learn-js
2 |
3 |
4 | **请确认你访问的是主版本 [nimojs/learn-js](https://github.com/nimojs/learn-js),在主版本中你可以看到所有人的代码提交**
5 |
6 | ---
7 |
8 | 这是一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。
9 |
10 | 组件开发的挑战是循序渐进的,每个组件开发挑战都必须掌握必要的知识才可以接受。
11 |
12 | > 点击右上角的 **[Watch](https://github.com/nimojs/learn-js/subscription)** 关注本项目,点击 Star 收藏本项目。
13 |
14 | ---
15 |
16 | **参与方式:**
17 | 选择挑战某个组件开发,按阶段完成任务。将自己的代码提交到对应组件中。
18 |
19 | [Fork & Pull Requests | 克隆与请求合并](fork&pullrequests.md)
20 |
21 | ## Tab 选项卡
22 |
23 |
24 |
25 |
26 | [接受挑战](package/tab/)
27 |
28 | ## Dialog 弹出层
29 |
30 |
31 |
32 | [接受挑战](package/dialog/)
--------------------------------------------------------------------------------
/fork&pullrequests.md:
--------------------------------------------------------------------------------
1 | # 克隆与请求合并
2 |
3 | ## 注册 GitHub 账号
4 |
5 | [https://github.com/join](https://github.com/join)
6 |
7 | ## Fork 此项目
8 |
9 | [https://github.com/nimojs/learn-js](https://github.com/nimojs/learn-js)
10 |
11 | 
12 |
13 | ## 安装 GitHub 客户端
14 |
15 | 下载 [GitHub Windows 离线安装包](http://static.nimojs.com/file/github/github-windows7.zip)
16 |
17 | 解压缩后打开 GitHub.exe
18 |
19 | 
20 |
21 |
22 | ## Clone 代码到本地
23 |
24 | 
25 |
26 |
27 | ## 编写代码
28 |
29 | 
30 |
31 | 在你所挑战的组件目录下的 `code` 文件夹创建你的 GitHub 用户名文件夹和对应挑战的阶段。如:
32 |
33 | ```
34 | └── package/
35 | └── tab
36 | └── code
37 | └── 2319103827 // 你的 GitHub 用户名
38 | └── 1 // 第一阶段代码
39 | └── index.html
40 | ```
41 |
42 | ## 提交代码
43 |
44 | 在 GitHub 中双击项目
45 |
46 | 
47 |
48 | 填写提交说明
49 |
50 | 
51 |
52 | 点击 COMMIT 按钮
53 |
54 | 同步代码
55 |
56 | 
57 |
58 | ## 请求合并代码至 [nimojs/learn-js](https://github.com/nimojs/learn-js/pulls)
59 |
60 | 打开 `https://github.com/你的用户名/learn-js/`
61 |
62 | 点击 Pull Requset
63 |
64 | 
65 |
66 | 点击 Create pull request
67 |
68 | 
69 |
70 | nimojs/learn-js 维护者收到 PR 后会合并你的请求。
71 |
72 | 最终你的代码会显示在 [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)
--------------------------------------------------------------------------------
/package/dialog/README.md:
--------------------------------------------------------------------------------
1 | # Dialog 弹出层
2 |
3 |
4 |
5 | ## 阶段 1
6 |
7 | 实现上图 JS 效果,CSS样式随意。弹出层要水平垂直居中在屏幕中
8 |
9 | ## 阶段 2
10 |
11 | 封装成一个 `dialog` 函数,提供如下 api :
12 |
13 | **trigger**
14 |
15 | 对话框触发元素,可传递选择器。
16 |
17 | **content**
18 |
19 | 容器的内容,可以是纯字符串、dom对象、jQuery对象、html标签字符串。
20 |
21 |
22 | ```js
23 | dialog({
24 | trigger: '#btn',
25 | content: '哈哈'
26 | })
27 | ```
28 |
29 | ```html
30 |
31 | ```
32 |
33 | 点击 Click me 弹出 **哈哈**
34 |
35 | 可通过参数指定父级DOM、触发DOM、内容DOM。
36 |
37 | ## 阶段3
38 | 可控制显示和关闭的动画效果
39 |
40 | ```js
41 | dialog({
42 | trigger: '#btn',
43 | content: '哈哈',
44 | effectShow: function ($element) {
45 | // 淡入显示
46 | $element.fadeIn(500)
47 | },
48 | effectHide: function ($element) {
49 | // 淡出显示
50 | $element.fadeOut(500)
51 | }
52 | })
53 | ```
54 |
55 | ## 阶段 4
56 | 添加点击关闭时触发的函数,并支持使用键盘 ESC 键关闭弹出层
57 |
58 | ```js
59 | dialog({
60 | trigger: '#btn',
61 | content: '哈哈',
62 | onClose: function (element) {
63 | /*
64 | element 弹出层 DOM 元素
65 | */
66 | }
67 | })
68 | ```
69 | ## 完成挑战
70 |
71 | 添加关闭事件
72 |
73 | 还有更多 API 可以实现,但以上四个阶段已经足够提高你 Dialog 类型组件开发的经验。
74 |
75 | 如果你将以上所有阶段都完成了, Dialog 的挑战就结束了。但我们希望你继续完善这个组件增加更多的 API。
76 |
--------------------------------------------------------------------------------
/package/dialog/code/52cik/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |26 |17 | var dialog1 = dialog({trigger:"#btn", zIndex:10, title:"D1", 18 | content:"这是第一个对话框。这个对话框会覆盖第二个对话框,因为这个对话框设置了 zIndex 属性", 19 | effectShow:function(e){$(e).show("fast")}, 20 | effectHide:function(e){$(e).hide("fast")}, 21 | onClose:function(e){console.log(e.innerText)}}); 22 | var dialog2 = dialog({trigger:"#btn2", title:"D2", content:"这是第二个对话框,这个对话框没有弹出关闭效果!这个对话框会被第一个对话框覆盖。", 23 | onClose:function(e){console.log("dialog 2 is closed")}}); 24 |25 |
I am content
\ 13 |64 | learn-js: 一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。 65 |
66 | 67 | -------------------------------------------------------------------------------- /package/tab/code/2319103827/index2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |73 | learn-js: 一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。 74 |
75 | 76 | -------------------------------------------------------------------------------- /package/tab/code/2319103827/index3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |75 | learn-js: 一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。 76 |
77 | 78 | -------------------------------------------------------------------------------- /package/tab/code/2319103827/index4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |78 | learn-js: 一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。 79 |
80 | 81 | -------------------------------------------------------------------------------- /package/tab/code/52cik/1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |66 | 尘劳回脱事非常,紧把绳头做一场。 67 | 不经一番寒彻骨,那得梅花扑鼻香. 68 |
69 |59 | learn-js: 一个 JavaScript 互助学习的项目。接受组件开发的挑战,提交代码让他人评论你的代码以提高。 60 |
61 | 81 | 82 | -------------------------------------------------------------------------------- /package/tab/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nimoc/learn-js/f88e70fd54b2aea33212efaa78f31a186ffd5213/package/tab/tab.png --------------------------------------------------------------------------------