我是靠谱客的博主 微笑秋天,这篇文章主要介绍jQuery简易时光轴实现方法示例,现在分享给大家,希望可以做个参考。

本文实例讲述了jQuery简易时光轴实现方法。分享给大家供大家参考,具体如下:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html> <html> <head> <meta charset='utf-8'> <title>timeLine</title> <style> body{ margin: 0; padding: 0; background: #e8ffe8; } #head, #content, #footer{ width: 1000px; margin: 0 auto; } #head{ text-align: center; height: 100px; line-height: 100px; } #footer{ clear: both; text-align: center; height: 30px; line-height: 30px; } /*-----大标题-----*/ .bigElement{ clear: both; position: relative; } .bigTitle{ font-size: 16px; font-weight: bold; height: 70px; line-height: 70px; background: #e8ffe8; color: #635d5a; } .bigAction, .bigInfo{ float: left; } .bigAction{ border-right: 3px solid #635d5a; text-align: right; width: 220px; } .bigButtonSeeMore{ float: right; width: 70px; height: 70px; text-align: center; } .bigButtonSeeMore > a{ text-decoration: none; display: block; color: #635d5a; outline: none; blr: expression(this.onFocus=this.blur()); } .bigButtonSeeMore > a:hover{ color: #8cdbff; } .bigContent{ clear: both; } /*-----大标题end-----*/ /*-----小标题-----*/ .smallElement{ clear: both; position: relative; height: auto; font-size: 16px; background: #e8ffe8; color: #635d5a; } .smallTitle{ text-align: right; width: 220px; } .smallTitle, .smallContent{ float: left; } .smallContent{ border-left: 3px solid #635d5a; } .smallInfo{ margin-top: 20px; text-indent: 40px; } /*-----小标题end-----*/ /*-----三角形-----*/ .bigTitleTrifonIconR{ border-color: #e8ffe8 #e8ffe8 #e8ffe8 #635d5a; border-style: solid; border-width: 7px; width: 0; height: 0; font-size: 0; position: absolute; top: 28px; left: 223px; } .smallTitleTrifonIconL{ border-color: #e8ffe8 #635d5a #e8ffe8 #e8ffe8; border-style: solid; border-width: 6px; width: 0; height: 0; font-size: 0; position: absolute; top: 23px; left: 208px; } /*模板*/ .hide{ display: none; } /*查看更多*/ .showMore{ clear: both; text-align: center; height: 70px; line-height: 70px; } .showMore:hover{ cursor: pointer; background: #FFEFDB; color: #8cdbff; } </style> </head> <body> <div id='head'> <span>订单小助手:</span> <input type='text' id='txtDoccode' /> </div> <div id='content'> <div class='timeLine'></div> <div class='showMore'>查看更多</div> </div> <div id='footer'>footer</div> <!-- 大标题模板 --> <div class='hide' id='bigTitleTpl'> <div class='bigElement'> <div class='bigTitle'> <div class='bigAction'>{bigAction} </div> <div class='bigInfo'> {bigInfo}</div> <div class='bigButtonSeeMore'><a href='javascript:;'>-</a></div> </div> <div class='bigTitleTrifonIconR'> </div> <div class='bigContent'></div> </div> </div> <!-- 详细信息模板 --> <div class='hide' id='bigContentTpl'> <div class='smallElement'> <div class='smallTitle'> <div class='smallTime'><br/>{smallTime} </div> </div> <div class='smallTitleTrifonIconL'> </div> <div class='smallContent'> <div class='smallAction'><br/> {smallAction}</div> <div class='smallInfo'> {smallInfo}</div> </div> </div> </div> <script src="http://libs.baidu.com/jquery/1.8.0/jquery.js"></script> <script> var index = 0; $(function(){ hqOrderNodeCreate();//总部下单 }) //总部下单 function hqOrderNodeCreate(){ var bigTitleData = { bigAction: '总部下单', bigInfo: '' }; createBigTitle(bigTitleData, index); } //基地生产 function baseOrderNodeCreate(){ var bigTitleData = { bigAction: '基地生产', bigInfo: '' }; createBigTitle(bigTitleData, index); } //仓库库存 function stockNodeCreate(){ var bigTitleData = { bigAction: '仓库库存', bigInfo: '' }; createBigTitle(bigTitleData, index); } //发货 function delNodeCreate(){ var bigTitleData = { bigAction: '发货', bigInfo: '' }; createBigTitle(bigTitleData, index); } //结算 function setNodeCreate(){ var bigTitleData = { bigAction: '结算', bigInfo: '' }; createBigTitle(bigTitleData, index); } //生成大标题,一次生成一个 function createBigTitle(bigTitleData, index){ //生成大标题 $('.timeLine').append($('#bigTitleTpl').html() .replace('{bigAction}', bigTitleData.bigAction) .replace('{bigInfo}', bigTitleData.bigInfo) ); //生成大标题下对应的内容 var bigContentData = [{ smallTime: '2010.10.11', smallAction: '录单 ' + index, smallInfo: '操作时间: 10:30:55' },{ smallTime: '2010.10.15', smallAction: '审核 ' + index, smallInfo: '操作时间: 10:10:55' },{ smallTime: '2010.10.15', smallAction: '分发 ' + index, smallInfo: '操作时间: 10:10:55' }]; var bigContentTplStr = $('#bigContentTpl').html(); var str = ''; for(var i=0; i< bigContentData.length; i++){ str += bigContentTplStr.replace('{smallTime}', bigContentData[i].smallTime) .replace('{smallAction}', bigContentData[i].smallAction) .replace('{smallInfo}', bigContentData[i].smallInfo); } $('.bigContent:eq(' + index + ')').html(str).hide().slideDown(500); } //查看更多, 每次点击生成一个新的节点 $('.showMore').on('click', function(){ if($(this).text() === '查看更多'){ if(index === 0){ index++; baseOrderNodeCreate();//基地生产 } else if(index === 1){ index++; stockNodeCreate();//仓库库存 } else if(index === 2){ index++; delNodeCreate();//发货 } else if(index === 3){ index++; setNodeCreate();//结算 $(this).text(' →_→ 没有记录了'); } } }) // + - 按钮 收缩效果 $(document).on('click', '.bigButtonSeeMore', function(){ var clickObj = $(this); var bigContentObj = clickObj.parent().next().next(); if(clickObj.text() === '+'){ bigContentObj.slideDown(500, function(){ clickObj.html('<a href="javascript:;" rel="external nofollow" rel="external nofollow" ">-</a>');//切换图标 }); } else if(clickObj.text() === '-'){ bigContentObj.slideUp(500, function(){ clickObj.html('<a href="javascript:;" rel="external nofollow" rel="external nofollow" ">+</a>'); }); } }) </script> </body> </html>

更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery扩展技巧总结》、《jQuery常用插件及用法总结》、《jQuery拖拽特效与技巧总结》、《jQuery表格(table)操作技巧汇总》、《jquery中Ajax用法总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》及《jquery选择器用法总结》

希望本文所述对大家jQuery程序设计有所帮助。

最后

以上就是微笑秋天最近收集整理的关于jQuery简易时光轴实现方法示例的全部内容,更多相关jQuery简易时光轴实现方法示例内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(137)

评论列表共有 0 条评论

立即
投稿
返回
顶部