富贵资源网 Design By www.hznty.com

本文实例介绍了javascript实现图片轮播效果的详细代码,分享给大家供大家参考,具体内容如下

效果图:

javascript实现图片轮播效果

具体代码:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style type="text/css">
  *{
    margin: 0;
    padding: 0;
  }
   .wrap{
     width: 510px;
     margin: 0 auto;
     overflow: hidden;
      position: relative;
   }
   .caktye{
     width: 9999px;
     overflow: hidden;
     position: relative;
     left: 0;
   }
   .main{
     text-align: center;
      position: absolute;
      bottom: 10px;
      /*border: 1px solid red;*/
      left: 35%;

   }
   .main button{
     width: 25px;
      height: 25px;
      text-align: center;
      line-height: 25px;
      border-radius: 25px;
      display: inline-block;
      border: none;
   }
   .active{
     background-color: yellow;
   }
   .caktye a{
     float: left;
   }
   .caktye img {
      display: block;
      width:510px;
    }
   #prevBtn{
        display: block;
        position: absolute;
        left: 5px;
        bottom: 45%;
      width: 15px;
      height: 15px;
      /*overflow: hidden;*/
      border-left: 5px solid ;
      border-top: 5px solid ;
       border-color: rgba(255,255,255,0.5);
      -webkit-transform: rotate(45deg);
      transform: rotate(-45deg);
   }
   #nextBtn{
      display: block;
      position: absolute;
      right: 5px;
      bottom: 45%;
      width: 15px;
      height: 15px;
      /*overflow: hidden;*/
      border-right: 5px solid;
      border-top: 5px solid;
      -webkit-transform: rotate(45deg);
      transform: rotate(45deg);
      border-color: rgba(255,255,255,0.5);
      /*background-color: rgba(255,255,255,0.8);*/
   }

  </style>
</head>
<body>
 
  <div class="wrap">
   <div class="caktye" id="inner">
    <a href="###"><img src="/UploadFiles/2021-04-02/1.jpg">

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

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com