js和jq实现轮播图

一.js实现




  
  
  
  Document
  


  

二.jq实现

1.html

   

1 2 3 4

2.css

   .swiper-wrap{
  width: 500px;
  margin: 50px auto;
  overflow: hidden;
  border:2px solid #f00;
  position: relative;
}
p{
  position: absolute;
  z-index: 100;
  top:0;
  left:0;
  background: #f00;
  padding:20px;
  cursor: pointer;
}
#next{
  left: auto;
  right:0;
}
#swiperBox{
  white-space: nowrap;
  font-size: 0px; 
  position: relative;
  width: 100%; 
  left: -500px;
}
#swiperBox li {  
  display: inline-block;
  width: 100%;
}
 
#swiperBox li img{  
  width: 100%;
}
.btm{
  position: absolute;
  z-index: 102;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
}
.btm i{
  

  display: inline-block;
  left: 50%;
  width: 50px;
  height: 30px;
  background-color: white;
  color: black;
  border-radius: 50%;
  line-height: 30px;
  text-align: center;
}

3.jq代码

  
                    
                    

你可能感兴趣的:(js和jq实现轮播图)