Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the effect of carousel by html5

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to achieve the effect of html5". Friends who are interested may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to achieve the effect of html5".

Css:

* {margin: 0 height padding: 0} {} .container {width: 100%; overflow: hidden; / * height: 400px; * / background: red; position: relative;} .box {width: 125%; height: auto; display: flex; align-items: center; position: relative; left: 0 } .box li {width: 20%; float: left; list-style: none;-webkit-transition: width 0.5s, height 0.5s, margin 0.5s; position: relative;} .box video {width: 100%; height: 100%;} .box li div {position: absolute; top: 0; bottom: 0 Left: 0; right: 0;} .box li div img {width: 100%; height: 100%;} / * .box li:nth-child (2) {height: 360px; margin: 0.1%;} * / .goLeft, .goright {position: absolute; width: 28px; height: 52px; top: 50% Transform: translate; cursor: pointer; border: none; outline: none; line-height: 52px;} .goLeft {left: 20%;} .goright {right: 20%;} .box li > p {margin: 0; color: # fff; position: absolute; top: 50% Left: 50%; transform: translate (- 50% background 50%); text-align: center;} .box li > p > span {display: inline-block; width: 100px; height: 100px; background: url (play.png);} .ddd {width: 100%; height: 360 px; display: flex;align-items: center;position: relative } .dd-2 {width: 20%; background: yellow;} .aa {width: 100%;}

Html:

one

two

three

4 right aaavvvv

Js:

$(function () {$('.box > li:nth (1)'). Css ({width:'36% margin:'02%'}) $('.box > li:nth (1)'). Append ('video theme')}) $(window) .resize (function () {/ / when the browser size changes, $('.box'). Css ('height') ) function moveLeft () {var height = $('.box > li:nth (1)'). Height () $('.box'). Css ('height', height) $(' .box > li'). Css ({width:'20% css, margin:'00%'}) $('.box > li:nth (2)'). Css ({width:'36%') Margin:'02%'}) $('.box'). Animate ({left:'- 25%'}, 400, function () {/ / move the first child element to the last And set left=0 $(".box") .append ($('.box > li:nth (0)') [0]) $(".dd-2") .append ($('.aa') [0]); $(".aa") .append ('ccc'); $(' .box') .css ('left', 0); $(".btn") .attr ("disabled", false); $(' .box > li:nth (1)') .append ('video theme')}) } function moveRight () {$('.box > li'). Css ({width:' 20% margin:'00%'}) $('.box > li:nth (0)') .css ({width:'36% li:nth, margin:'02%'}) var height = $('.box > li:nth (1)'). Height () $('.box'). Css ('height'') Height) $(".box") .prepend ($('.box > li:nth (3)') [0]) $('.box'). Css ('left','-20%'); $('.box') .animate ({left: 0}, 400, function () {$(".btn"). Attr ("disabled", false); $('.box > li:nth (1)'). Append ('video theme')}) } at this point, I believe you have a deeper understanding of "how to achieve the effect of html5". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report