|
8 | 8 | <script type="text/javascript" src="js/angular/angular.min.js"></script> |
9 | 9 | <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.10/angular-route.min.js"></script> |
10 | 10 | <style type="text/css"> |
11 | | - body, ul, ol, p{ |
| 11 | + body, ul, ol, p, h2{ |
12 | 12 | margin: 0; |
13 | 13 | padding: 0; |
14 | 14 | } |
|
19 | 19 | li{ |
20 | 20 | list-style: none; |
21 | 21 | } |
| 22 | + a{ |
| 23 | + text-decoration: none; |
| 24 | + } |
| 25 | + /*nav*/ |
22 | 26 | .nav{ |
23 | 27 | width: 100%; |
24 | 28 | position: fixed; |
25 | 29 | left: 0; |
26 | 30 | z-index: 999; |
27 | 31 | text-align: center; |
28 | | - display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */ |
29 | | - display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */ |
| 32 | + display: box; |
| 33 | + display: -webkit-box; |
30 | 34 | display: -ms-flexbox; /* TWEENER - IE 10 */ |
31 | 35 | display: -webkit-flex; /* NEW - Chrome */ |
32 | 36 | display: flex; |
|
74 | 78 | line-height: .6rem; |
75 | 79 | font-size: .3rem; |
76 | 80 | } |
77 | | - |
| 81 | + /*图片轮播*/ |
78 | 82 | .carousel{ |
79 | 83 | width: 100%; |
80 | 84 | height: 3.5rem; |
|
127 | 131 | color: #ff5500; |
128 | 132 | } |
129 | 133 |
|
130 | | - /*pro*/ |
| 134 | + /*产品列表*/ |
131 | 135 | .pro{ |
132 | 136 | width: 100%; |
133 | 137 | padding: .5rem 0 0 0; |
|
151 | 155 | left: 0; |
152 | 156 | top: 0; |
153 | 157 | z-index: 1; |
154 | | - border-radius: 10px; |
| 158 | + border-radius: 10px;/* |
155 | 159 | transform: matrix(0.5, 0, 0, 0.7, 50, 10); |
156 | 160 | -moz-transform: matrix(0.5, 0, 0, 0.7, 50, 10); |
157 | 161 | -webkit-transform: matrix(.5, 0, 0, .7, 50, 10); |
158 | 162 | transition : all .3s ease-in-out; |
159 | | - -moz-transform : all .3s ease-in-out; |
160 | | - -webkit-transform : all .3s ease-in-out; |
| 163 | + -moz-transition : all .3s ease-in-out; |
| 164 | + -webkit-transition : all .3s ease-in-out;*/ |
| 165 | + } |
| 166 | + /*我的资产*/ |
| 167 | + .cash{ |
| 168 | + letter-spacing: -1px; |
| 169 | + } |
| 170 | + .cash_top{ |
| 171 | + padding: .5rem; |
| 172 | + height: 3.3rem; |
| 173 | + background-color: #ff5500; |
| 174 | + font-size: .5rem; |
| 175 | + color: #ffffff; |
| 176 | + } |
| 177 | + .cash_top p{ |
| 178 | + position: relative; |
| 179 | + height: 1rem; |
| 180 | + line-height: 1rem; |
| 181 | + } |
| 182 | + .cash_top a{ |
| 183 | + position: absolute; |
| 184 | + right: 0; |
| 185 | + color: #ffffff; |
| 186 | + } |
| 187 | + .cash_top a i{ |
| 188 | + font-size: .6rem; |
| 189 | + } |
| 190 | + .cash_top h2{ |
| 191 | + line-height: 3rem; |
| 192 | + font-weight: 100; |
| 193 | + font-size: 2rem; |
| 194 | + font-family: Arial; |
| 195 | + } |
| 196 | + .cash_middle{ |
| 197 | + height: 2.5rem; |
| 198 | + padding: .5rem; |
| 199 | + background-color: #ffffff; |
| 200 | + border-bottom: 1px solid red; |
| 201 | + } |
| 202 | + .cash_middle p{ |
| 203 | + line-height: .5rem; |
| 204 | + font-size: .5rem; |
| 205 | + color: #939393; |
| 206 | + } |
| 207 | + .cash_middle h2{ |
| 208 | + line-height: 2.4rem; |
| 209 | + font-weight: 100; |
| 210 | + font-size: 1.6rem; |
| 211 | + font-family: Arial; |
| 212 | + color: #696969; |
| 213 | + } |
| 214 | + .cash_m_yesterday, .cash_m_all{ |
| 215 | + width: 48%; |
| 216 | + height: 100%; |
| 217 | + float: left; |
| 218 | + } |
| 219 | + .cash_m_all{ |
| 220 | + width: 44%; |
| 221 | + padding-left: 5%; |
| 222 | + border-left: 1px solid #c7c7c7; |
| 223 | + } |
| 224 | + .cash_m_yesterday h2{ |
| 225 | + color: #cc5500; |
161 | 226 | } |
162 | 227 | </style> |
163 | 228 | </head> |
|
190 | 255 | <div class="nav head"> |
191 | 256 | <span>{{title}}</span> |
192 | 257 | </div> |
193 | | - |
| 258 | + <!----> |
194 | 259 | <div class="carousel" id="carousel"> |
195 | 260 | <ul> |
196 | 261 | <li style="background-color: #0c63ee"><a href="#"><img src="" alt=""></a></li> |
|
200 | 265 | <ol> |
201 | 266 | </ol> |
202 | 267 | </div> |
203 | | - |
| 268 | + |
204 | 269 | </script> |
205 | 270 | <!-- pro template --> |
206 | 271 | <script type="text/ng-template" id="pro.html"> |
207 | 272 | <div class="nav head"> |
208 | 273 | <span>{{title}}</span> |
209 | 274 | </div> |
| 275 | + <!----> |
210 | 276 | <div class="pro" id="pro"> |
211 | 277 | <ul class="pro_list"> |
212 | 278 | <li style="background-color: #123456"></li> |
|
215 | 281 | <li style="background-color: red"></li> |
216 | 282 | </ul> |
217 | 283 | </div> |
| 284 | + |
218 | 285 | </script> |
219 | 286 | <!-- cash template --> |
220 | 287 | <script type="text/ng-template" id="cash.html"> |
221 | 288 | <div class="nav head"> |
222 | 289 | <span>{{title}}</span> |
223 | 290 | </div> |
| 291 | + <div class="cash" id="cash"> |
| 292 | + <div class="cash_top"> |
| 293 | + <p> |
| 294 | + <span>总资产(元)</span> |
| 295 | + <a href="javascript:;"> |
| 296 | + 交易记录 <i class="fa fa-angle-double-right"></i> |
| 297 | + </a> |
| 298 | + </p> |
| 299 | + <h2>0.00</h2> |
| 300 | + </div> |
| 301 | + <div class="cash_middle"> |
| 302 | + <div class="cash_m_yesterday"> |
| 303 | + <p>昨日收益(元)</p> |
| 304 | + <h2>0.00</h2> |
| 305 | + </div> |
| 306 | + <div class="cash_m_all"> |
| 307 | + <p>累计收益(元)</p> |
| 308 | + <h2>24.16</h2> |
| 309 | + </div> |
| 310 | + </div> |
| 311 | + </div> |
224 | 312 | </script> |
225 | 313 | <!-- more template --> |
226 | 314 | <script type="text/ng-template" id="more.html"> |
|
230 | 318 | </script> |
231 | 319 |
|
232 | 320 | <script type="text/javascript"> |
| 321 | + // 重置HTML的rem |
233 | 322 | function reSetRem(){ |
234 | 323 | var html = document.getElementsByTagName("html")[0]; |
235 | 324 | var rem = document.body.clientWidth/10; |
236 | 325 | if(window.navigator.userAgent.match(/Firefox/gi)){ |
237 | 326 | rem = screen.availWidth/10; |
238 | 327 | } |
239 | 328 | html.style.fontSize = rem+"px"; |
240 | | - // // document.getElementById("get2").innerHTML = rem; |
241 | | - |
242 | | - // setInterval(function(){ |
243 | | - // var rem = document.getElementsByTagName("html")[0].style.fontSize; |
244 | | - // document.getElementById("get2").innerHTML = rem+Math.random(); |
245 | | - // },1000) |
246 | 329 | } |
247 | 330 | reSetRem(); |
248 | 331 | </script> |
249 | 332 |
|
250 | 333 | <script type="text/javascript"> |
251 | 334 |
|
252 | | - |
| 335 | + // 切换栏目根据路由给出active |
253 | 336 | function footActive(index){ |
254 | 337 |
|
255 | 338 | var foot_link = document.getElementById("foot").getElementsByTagName("a"); |
|
272 | 355 |
|
273 | 356 |
|
274 | 357 | <script type="text/javascript"> |
| 358 | + // 设置products栏目的高度 |
| 359 | + // 在用户切换到产品栏目运行 |
275 | 360 | function setProHeight(){ |
276 | 361 |
|
277 | 362 | var pro = document.getElementById("pro"); |
|
284 | 369 |
|
285 | 370 | pro.style.height = proH + "px"; |
286 | 371 |
|
287 | | - } |
288 | | - |
289 | | - // setProHeight(); |
| 372 | + // 监听页面的缩放,改变产品栏目的高度 |
| 373 | + window.addEventListener("resize", function(){ |
| 374 | + setProHeight(); |
| 375 | + }) |
290 | 376 |
|
291 | | -</script> |
292 | | -<script type="text/javascript"> |
293 | | - |
294 | | - window.addEventListener("resize", function(){ |
295 | | - setProHeight(); |
296 | | - }) |
| 377 | + } |
297 | 378 |
|
298 | 379 | </script> |
299 | 380 |
|
300 | 381 | <script type="text/javascript"> |
301 | 382 |
|
| 383 | + // 产品栏目的列表切换程序 |
302 | 384 | function proRun(){ |
303 | 385 |
|
304 | 386 | var proList = document.getElementById("pro").getElementsByTagName("ul")[0]; |
|
319 | 401 | } |
320 | 402 |
|
321 | 403 | proAnimate.forEach(function (el, i){ |
| 404 | + // console.log(el, i) |
| 405 | + el.style.transition = "all .3s ease-in-out"; |
| 406 | + el.style["-moz-transition"] = "all .3s ease-in-out"; |
| 407 | + el.style["-webkit-transition"] = "all .3s ease-in-out"; |
322 | 408 |
|
323 | 409 | el.addEventListener("touchstart", function proSwapSatrt (e){ |
324 | 410 |
|
325 | 411 | var changedDom = this; |
326 | 412 |
|
| 413 | + console.log(changedDom) |
| 414 | + |
327 | 415 | var SX = e.changedTouches[0].clientX; |
328 | 416 | var SY = e.changedTouches[0].clientY; |
329 | 417 |
|
|
334 | 422 |
|
335 | 423 | var X = EX - SX, Y = EY - SY; |
336 | 424 |
|
337 | | - if(X>100){ |
| 425 | + if(X>70){ |
338 | 426 | changedDom.style.transform = "matrix(.6, 0, 0, .9, "+400+", 0)"; |
339 | 427 | changedDom.style["-moz-transform"] = "matrix(.6, 0, 0, .9, "+400+", 0)"; |
340 | 428 | changedDom.style["-webkit-transform"] = "matrix(.6, 0, 0, .9, "+400+", 0)"; |
341 | | - }else if(X<-100){ |
| 429 | + }else if(X<-70){ |
342 | 430 | changedDom.style.transform = "matrix(.6, 0, 0, .9, "+-400+", 0)"; |
343 | 431 | changedDom.style["-moz-transform"] = "matrix(.6, 0, 0, .9, "+-400+", 0)"; |
344 | 432 | changedDom.style["-webkit-transform"] = "matrix(.6, 0, 0, .9, "+-400+", 0)"; |
|
362 | 450 |
|
363 | 451 | },200); |
364 | 452 |
|
365 | | - return document.removeEventListener("touchend", proSwapEnd); |
| 453 | + // changedDom = null; |
| 454 | + document.removeEventListener("touchend", proSwapEnd); |
366 | 455 |
|
367 | 456 | }); |
368 | 457 |
|
|
378 | 467 | <script type="text/javascript"> |
379 | 468 | var myApp = angular.module('myApp', ['ngRoute']); |
380 | 469 |
|
| 470 | + // 路由控制 |
381 | 471 | myApp.config(function ($routeProvider){ |
382 | 472 |
|
383 | 473 | $routeProvider.when("/", { |
|
418 | 508 |
|
419 | 509 | }); |
420 | 510 |
|
| 511 | + // 添加控制器 |
421 | 512 | myApp.controller("HomeCtrl", function ($scope){ |
422 | 513 | $scope.title = "精选推荐"; |
423 | 514 | footActive(0); |
|
445 | 536 |
|
446 | 537 |
|
447 | 538 | <script type="text/javascript"> |
| 539 | + |
| 540 | + // 首页的图片轮播程序 |
448 | 541 | function run(){ |
449 | 542 | var carousel = document.getElementById("carousel"); |
450 | 543 | var carouselUl = carousel.getElementsByTagName("ul")[0]; |
|
464 | 557 | } |
465 | 558 |
|
466 | 559 | var timer = null, index = 0; |
467 | | - // clearInterval(timer); |
| 560 | + |
468 | 561 | timer = setInterval(function(){ |
469 | | - // clearInterval(timer); |
470 | 562 | index++; |
471 | 563 | index = index%3; |
472 | 564 | runCarousel(index); |
473 | 565 | console.log(index+"--"+new Date().getTime()); |
474 | 566 | }, 3000); |
475 | 567 |
|
476 | | - // var get = document.getElementById("get"); |
477 | | - |
478 | 568 | carousel.addEventListener("touchstart", function carouselStart(e){ |
479 | 569 | var SX = e.changedTouches[0].clientX; |
480 | 570 | var SY = e.changedTouches[0].clientY; |
|
507 | 597 | clearInterval(timer); |
508 | 598 |
|
509 | 599 | timer = setInterval(function(){ |
510 | | - // clearInterval(timer); |
511 | 600 | index = index%3; |
512 | 601 | runCarousel(index); |
513 | 602 | console.log(index+"--"+new Date().getTime()); |
|
520 | 609 | }); |
521 | 610 |
|
522 | 611 | function runCarousel(index){ |
523 | | - // get.innerHTML = index; |
524 | 612 | carouselUl.className = "active"+(index+1); |
525 | 613 | for(var i=0; i<carouselLen; i++){ |
526 | 614 | carouselOl.getElementsByTagName("li")[i].className = ""; |
|
0 commit comments