博主信息
博文 21
粉丝 0
评论 0
访问量 24777
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
图片轮播及TAB切换
电动机的博客
原创
846人浏览过

//TAB切换

<!DOCTYPE html>
<html>
<head>
 <title>tab切换</title>
 <style type="text/css">
  .box{
   width: 500px;
   height: 300px;
   margin: 50px auto;
   background-color: pink;
   position: relative;
   /*overflow: hidden; *//*超出box大小的图片隐藏*/
   /*position: relative;相对定位 */
    }
  ul{width: 460px;
   height: 30px;
   margin: 50px auto;
   background-color: #ccc;
  }
  li{
   list-style: none;
   float: left;
   width: 100px;
   height: 28px;
   line-height: 28px;
   border: 1px solid #bbb;
   border-top-left-radius: 20%;
            border-top-right-radius: 20%;
   cursor: pointer;

  }
  li:hover {background-color: red;}
  .photo{
   width: 500px;
   height: 210px;
   margin: 0px auto;
   overflow: hidden;
   position: absolute;
  }
  span{
   display: inline-block;
   width: 500px; height: 20px;
   margin: 80px auto;
   text-align: center;
      font-size:30px; }
  
 </style>
</head>
<body>
    <div class="box">

        <ul>
         <li onclick="tab(0)">tab1</li>
         <li onclick="tab(1)">tab1</li>
         <li onclick="tab(2)">tab1</li>
        </ul>
        <span>我是谁?</span>
        <script type="text/javascript">
            function tab(i){
             var a=['我是TAB1','我是TAB2','我是TAB3']
         
                var Espan=document.getElementsByTagName('span')[0]
            
                        Espan.innerHTML=a[i];
               
            }
        </script>
       
       
   </div>
  </div>
 </script>
   </body>
</html>

1553834700561256.jpg

//轮播动画


<!DOCTYPE html>
<html>
<head>
 <title>轮播动画</title>
 <style type="text/css">
  .box{
   width: 500px;
   height: 300px;
   margin: 50px auto;
   overflow: hidden; /*超出box大小的图片隐藏*/
   position: relative;/*相对定位*/
  }
  img{width: 500px;height: 300px;}
  p{
   color: #fff;
   width: 500px;height: 30px;
   position: absolute;z-index: 1000;bottom: 0;left:0; /*绝对定位*/
   text-align: center;
   line-height: 30px;
  }
  p span{
   display: inline-block;/*转换成块级元素可以设置高度*/
   width: 20px; height: 20px;
   text-align: center;
   background: rgba(254,254,254,0.6);
   border-radius: 50%;
   line-height: 20px;
   cursor: pointer; /*鼠标指到时小手的效果*/
  }
 </style>
</head>
<body>
   <div class="box" id="photo">
        <a href=""><img src="images/1.jpg"></a>
     <a href=""><img src="images/2.jpg"></a>
     <a href=""><img src="images/3.jpg"></a>
     <a href=""><img src="images/4.jpg"></a>
  <a href=""><img src="images/5.jpg"></a>
  <p>
     <span onclick="change(0)">1</span>
     <span onclick="change(1)">2</span>
     <span onclick="change(2)">3</span>
     <span onclick="change(3)">4</span>
     <span onclick="change(4)">5</span>
  </p>
   </div>

   <script type="text/javascript">
        function change(num){
         var obj=document.getElementById('photo')
         var obj_a=obj.getElementsByTagName('a');
         for(var i=0;i<obj_a.length;i++){
          obj_a[i].style.display="none";
         }
           obj_a[num].style.display="block";
       }
 </script>
   </body>
</html>

 1553834635140452.jpg

批改状态:未批改

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学