欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  <!DOCTYPEhtml>
 
  <html>
 
  <head>
 
  <metacharset="UTF-8">
 
  <title>css怎么实现图片滑动</title>
 
  <styletype="text/css">
 
  img{
 
  height:200px;
 
  width:200px;
 
  }
 
  .slider{
 
  overflow-y:hidden;
 
  max-height:500px;
 
  /*最大高度*/
 
  background:pink;
 
  height:200px;
 
  width:200px;
 
  /*Webkit内核浏览器:SafariandChrome*/
 
  -webkit-transition-property:all;
 
  -webkit-transition-duration:.5s;
 
  -webkit-transition-timing-function:cubic-bezier(0,1,0.5,1);
 
  /*Mozilla内核浏览器:firefox3.5+*/
 
  -moz-transition-property:all;
 
  -moz-transition-duration:.5s;
 
  -moz-transition-timing-function:cubic-bezier(0,1,0.5,1);
 
  /*Opera*/
 
  -o-transition-property:all;
 
  -o-transition-duration:.5s;
 
  -o-transition-timing-function:cubic-bezier(0,1,0.5,1);
 
  /*IE9*/
 
  -ms-transition-property:all;
 
  -ms-transition-duration:.5s;
 
  -ms-transition-timing-function:cubic-bezier(0,1,0.5,1);
 
  }
 
  .slider.closed{
 
  max-height:0;
 
  }
 
  </style>
 
  </head>
 
  <body>
 
  <divstyle="height:200px;width:200px;border:1pxsolid#ccc;">
 
  <divclass="slider"id="slider">
 
  <imgsrc="2.png">
 
  </div>
 
  </div>
 
  <buttononclick="document.getElementById('slider').classList.toggle('closed');">点击试试</button>
 
  </body>
 
  <html>





本文转载自中文网


 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56819.shtml