学习较慢,今天做的轮播图大家一起来评论下吧

html代码:

DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Documenttitle>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .box{
            width: 613px;
            height: 230px;
            margin: 0 auto;
            position: relative;
        }
        .box img{
            width: 100%;
            height: 100%;
            position: absolute;
            top:0;
            left: 0;
        }
        .ctrols{
            width: 112px;
            height: 16px;
            position: absolute;
            bottom: 26px;
            right: 60px;
            z-index: 999;
        }
        .ctrols span{
            display: inline-block;
            border: 2px solid #fff;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            margin-right: 8px;
            background-color: rgb(0,0,0,.2);
        }
        .box img:nth-child(1){
           z-index: 1;
        }
        .ctrols span:nth-child(5){
            margin-right: 0;
        }
        .ctrols span.on{
            background-color: orange;
        }
        .arrow-left ,.arrow-right{
            position: absolute;
            top: 50%;
            width: 30px;
            height: 50px;
            margin-top: -25px;
            background-color:rgb(0,0,0,.2);
            z-index: 10;
            font-size: 30px;
            color: #fff;
            text-align: center;
            line-height: 50px;
        }
        .arrow-left{
            left: 0;
        }
        .arrow-right{
            right: 0;
        }
    style>
head>
<body>
    <div class="box">
        <img src="images/img01.jpg"/>//所用图片大家可以随意改变
        <img src="images/img02.jpg"/>
        <img src="images/img03.jpg"/>
        <img src="images/img04.jpg"/>
        <img src="images/img05.jpg"/>
        <div class="ctrols">
            <span class="on">span><span>span><span>span><span>span><span>span>
        div>
        <div class="arrow">
            <div class="arrow-left"><>
            <div class="arrow-right">>div>
        div>
    div>
body>
html>

js代码:

静态效果:

学习较慢,今天做的轮播图大家一起来评论下吧_第1张图片

 

你可能感兴趣的:(学习较慢,今天做的轮播图大家一起来评论下吧)