java script 如何将盒子里的东西布局360度。

来源:互联网 发布:淘宝举报中心网址 编辑:程序博客网 时间:2024/06/10 03:12
<!doctype html>
<html>
 <head>
  <meta charset="UTF-8">
  <meta name="Keywords" content="关键词">
  <meta name="Description" content="描述信息">
  <title>520</title>


  <style type="text/css">
    *{margin:0;padding:0;}
.top {height:100px;width:400px;margin:60px auto;font-size:30px;font-family:"华文行楷";}


.box{width:310px;height:310px;margin:auto; perspective:800px;}
    .box.pic{position:relative; transform-style:preserve-3d;}
    .box ul li{ list-style:none; position:absolute; top:0; left:0;}
 
  </style>
 </head>
 
 <body>
  <div class="top"> 
<marquee behavior=alternate> 时光不老,我们不散.</marquee></div>
  <div class="box">
     <div class="pic"> 
        <ul>
            <li> <img src="image/1.png" height="" width="" alt="描述"/> </li>
            <li> <img src="image/2.png" height="" width="" alt="描述"/> </li>
            <li> <img src="image/3.png" height="" width="" alt="描述"/> </li>
            <li> <img src="image/4.png" height="" width="" alt="描述"/> </li>
            <li> <img src="image/5.png" height="" width="" alt="描述"/> </li>
            <li> <img src="image/6.png" height="" width="" alt="描述"/> </li>
        </ul>
   </div>
  </div>
  <script src="js/jquery-3.2.1.min.js"></script>
   <script>
   
     $(".pic ul li").each(function(i){
  var deg=360/6;
  $(this).css({"transform":"rotateY("+deg*i+"deg) transLateZ(216px)"});
 
});
   </script>
 </body>
</html>
原创粉丝点击