麻烦老师看看,这是一个视频列表,电脑上手机模式上测试和手机端上直接测试,效果不一样
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 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | <!DOCTYPE html> < html > < head > < title >商学院</ title > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" > < meta name = "format-detection" content = "telephone=no,email=no,date=no,address=no" > < script type = "text/javascript" src = "js/jquery-3.2.1.min.js" ></ script > < script type = "text/javascript" src = "js/rem.js" ></ script > < style type = "text/css" > *{ padding: 0; margin: 0; } html,body{ height: 100%; } .container{ height: 100%; background: #f0f0f0; } ul li{ list-style: none; } a,input,button,textarea{ outline: 0; text-decoration: none; } em,i,samp{ font-style: normal; font-family: PingFang-SC-Medium; } h4,h5,h6{ font-weight: normal; } body{ font-family: PingFang-SC-Medium; font-size: 0.24rem; color: #192469; background: #fff; } .hide{ display: none !important; } /*头部*/ .head{ display: flex; align-items: center; justify-content: space-between; padding: 0 0.2rem; height: 1.3rem; position: fixed; top: 0; left: 0; z-index: 33; } .head .title{ font-size: 0.6rem; color: #111; padding-left: 0.2rem; width: 2.24rem; } .search{ position: relative; } .search img{ position: absolute; top: 0.1rem; left: 0.34rem; width: 0.29rem; height: 0.27rem; } .search input{ width: 2.55rem; height: 0.48rem; background-color: #ffffff; box-shadow: 0px 0px 0.7px 1px #efefef; border-radius: 0.21rem; border: none; padding-left: 1rem; } .search input::-webkit-input-placeholder{ padding-left: 0.14rem; font-size: 0.24rem; color: #838383; } .shop-car img{ width: 0.62rem; height: 0.62rem; } .menu img{ width: 0.33rem; height: 0.32rem; } .content{ margin-top: 0.8rem; } /*底部*/ footer{ position: fixed; bottom: 0; left: 0; background: #fff; z-index: 33; height: 0.98rem; display: flex; align-items: center; justify-content: space-between; box-shadow: -6px 0px 4px 0px rgba(135, 135, 135, 0.22); padding: 0 0.56rem; width: calc(100% - 1.12rem); } footer a{ display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; } footer a span{ font-size: 0.2rem; line-height: 0.2rem; color: #6c6c6c; margin-top: 0.1rem; } footer .active span{ color: #d81e06; } footer a i{ width: 0.42rem; height: 0.4rem; background-position: center; background-repeat: no-repeat; } footer a .icon-index{ background-size: 0.42rem 0.37rem; } footer a .icon-classify{ background-size: 0.33rem 0.37rem; } footer a .icon-book{ background-size: 0.42rem 0.40rem; } footer a .icon-discover{ background-size: 0.34rem 0.37rem; } footer a .icon-mine{ background-size: 0.33rem 0.39rem; } .head-title{ height: 0.8rem; width: 100%; display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 4px; background: #fff; position: fixed; top: 0; left: 0; z-index: 33; } .head-title h4{ font-size: 0.36rem; color: #1a1a1a; } .head-title img{ width: 0.25rem; height: 0.43rem; position: absolute; top: 0.2rem; left: 0.25rem; } .head_red{ height: 0.87rem; background-image: linear-gradient(156deg, #ff9fbc 0%, #ff739b 0%, #fe467a 0%, #e3241a 100%), linear-gradient( #e52826, #e52826); } .head_red h4{ color: #fff; } .nav{ margin-bottom: 0.06rem; } .nav ul{ height: 0.87rem; padding: 0 0.33rem; display: flex; align-items: center; justify-content: space-between; background: #fff; } .nav ul li{ height: 0.87rem; line-height: 0.87rem; position: relative; } .nav ul li a{ font-size: 0.3rem; color: #3a3a3a; } .nav ul .active a{ color: #f12825; } .nav ul .active i{ display: block; width: 0.5rem; height: 0.07rem; background-color: #e8374a; border-radius: 3px; position: absolute; bottom: 0; left: 50%; margin-left: -0.25rem; } /*白色标题*/ .head-title-white h4{ color: #fff; } /*遮罩*/ .mask{ width: 100%; height: 100%; background: #000; opacity: 0.6; position: fixed; top: 0; left: 0; z-index: 8; } .container{ margin-bottom: 1rem; } .head{ position: fixed; top: 0; z-index: 3; background: #fff; width: calc(100% - 0.4rem); } .nav{ position: fixed; top: 1.3rem; z-index: 3; width: 100%; } .nav ul{ height: 0.7rem; background-color: #ffffff; box-shadow: 0px 0px 7px 1px #f2f1f0; /*border-radius: 0.2rem;*/ font-size: 0.28rem; color: #8b8b8b; margin-bottom: 0.4rem; } .nav ul .active{ color: #d81e06; } /*视频列表*/ .list{margin-top: 2.4rem; padding: 0 0.17rem; } .list .item{ width: 100%; margin-bottom: 0.4rem; } .video{ width: 100%; height: 3.87rem; border-radius: 0.2rem; overflow: hidden; position: relative; } .video video{ width: 100%; height: 100%; } .video .mask{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: 0.2; z-index: 0; } .video h4{ position: absolute; top: 0.27rem; left: 0.15rem; color: #fff; font-size: 0.4rem; line-height: 0.4rem; } .video .play{ position: absolute; top: 1.33rem; left: 3.07rem; width: 1.04rem; height: 1.04rem; } .video .play img{ width: 100%; height: 100%; } .video .line{ position: absolute; bottom: 0.35rem; left: 0; width: 100%; display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 0.24rem; } .video .line p{ padding: 0 0.25rem 0 0.16rem; } .item .work{ width: 100%; height: 0.85rem; text-align: right; } .item .work div{ padding: 0 0.25rem; display: inline-block; height: 100%; line-height: 0.85rem; } .item .work .message img{ width: 0.42rem; height: 0.41rem; vertical-align: middle; } .item .work .more img{ width: 0.35rem; height: 0.09rem; vertical-align: middle; } /*底部*/ footer a .icon-index{ background-image: url('../img/icon/home.png'); } footer a .icon-classify{ background-image: url('../img/icon/classify.png'); } footer a .icon-book{ background-image: url('../img/icon/book-red.png'); } footer a .icon-discover{ background-image: url('../img/icon/discover.png'); } footer a .icon-mine{ background-image: url('../img/icon/mine.png'); } </ style > </ head > < body > < div class = "container" > <!-- 搜索 --> < div class = "head" > < div class = "title" > < h4 >商学院</ h4 > </ div > < div class = "search" > < input type = "text" name = "" placeholder = "输入搜索商品" > < img src = "img/icon/search.png" > </ div > < div class = "shop-car" > < img src = "img/icon/shop-car.png" > </ div > </ div > < div class = "nav" > < ul > < li class = "active" >产品系列</ li > < li >业务范围</ li > < li >大咖分享</ li > < li >明星风采</ li > </ ul > </ div > <!-- 视频列表 --> < div class = "list" > < div class = "item" > < div class = "video" > < video class = "video" poster = "img/goods/goods.png" /> < source src = "video/dengnixiake.mp4" type = "video/mp4" /> </ video > < div class = "mask" ></ div > < h4 >德国为何会出局</ h4 > < div class = "play" > < img src = "img/icon/play.png" > </ div > < div class = "line" > < p >< span >1312</ span >次播放</ p > < p class = "time" ></ p > </ div > </ div > < div class = "work hide" > < div class = "message" > < img src = "img/icon/message.png" > </ div > < div class = "more" > < img src = "img/icon/more.png" > </ div > </ div > </ div > < div class = "item" > < div class = "video" > < video class = "video" poster = "img/goods/goods.png" /> < source src = "video/dengnixiake.mp4" type = "video/mp4" /> </ video > < div class = "mask" ></ div > < h4 >德国为何会出局</ h4 > < div class = "play" > < img src = "img/icon/play.png" > </ div > < div class = "line" > < p >< span >1312</ span >次播放</ p > < p class = "time" ></ p > </ div > </ div > < div class = "work hide" > < div class = "message" > < img src = "img/icon/message.png" > </ div > < div class = "more" > < img src = "img/icon/more.png" > </ div > </ div > </ div > < div class = "item" > < div class = "video" > < video class = "video" poster = "img/goods/goods.png" /> < source src = "video/dengnixiake.mp4" type = "video/mp4" /> </ video > < div class = "mask" ></ div > < h4 >德国为何会出局</ h4 > < div class = "play" > < img src = "img/icon/play.png" > </ div > < div class = "line" > < p >< span >1312</ span >次播放</ p > < p class = "time" ></ p > </ div > </ div > < div class = "work hide" > < div class = "message" > < img src = "img/icon/message.png" > </ div > < div class = "more" > < img src = "img/icon/more.png" > </ div > </ div > </ div > </ div > <!-- 底部 --> < footer > < a href = "index.html" > < i class = "icon-index" ></ i > < span >首页</ span > </ a > < a href = "classify.html" > < i class = "icon-classify" ></ i > < span >分类</ span > </ a > < a class = "active" href = "business.html" > < i class = "icon-book" ></ i > < span >商学院</ span > </ a > < a > < i class = "icon-discover" ></ i > < span >发现</ span > </ a > < a href = "mine.html" > < i class = "icon-mine" ></ i > < span >我的</ span > </ a > </ footer > </ div > </ body > < script type = "text/javascript" > $('.nav li').click(function(){ $('.nav li').removeClass('active') $(this).addClass('active') }) var v = document.getElementsByClassName('video') // for (var i = 0; i < v.length; i++) { // console.log(v[i].duration) // } for (var i = 0; i < v.length; i++) { v[i].onloadedmetadata = function(){ $('video').each(function(){ var seconds = $(this).get(0).duration $('.line .time').html(totalTime(seconds)) }) // var seconds = v.duration } } var totalTime = function(seconds){ var minite = Math.floor(seconds / 60) if (minite< 10 ) { minite = "0" + minite } var second = Math.floor(seconds % 60 ) if (second<10) { second = "0" + second } return minite+":"+second } var play = function(is){ $(is).siblings('h4').addClass('hide') $(is).siblings('.mask').addClass('hide') $(is).siblings('.line').addClass('hide') $(is).addClass('hide') $(is).siblings('video').trigger('play') } $('.play').each(function(index){ $(this).click(function(){ play(this) var _video = $(this).siblings('video').get(0) console.log(_video) var self = this $(self).siblings('video').click(function(){ if (_video.paused === false) { _video.pause() $(self).removeClass('hide') $(self).siblings('h4').removeClass('hide') $(self).siblings('.mask').removeClass('hide') $(self).siblings('.line').removeClass('hide') } }) }) }) </script> </ html > |
老师能帮忙看看吗
0
收起
正在回答 回答被采纳积分+1
2回答
响应式开发与常用框架 2018
- 参与学习 人
- 提交作业 2198 份
- 解答问题 5012 个
如果你有web端基础,既想进阶,又想进军移动端开发,那就来吧,我们专题为你带来的课程有HTML5、CSS3、移动基础、响应式、bootstrap、less等,让你在前端道路上畅通无阻!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧