zoukankan      html  css  js  c++  java
  • CSS jQuery 图片全屏切换

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
        <style>
            body{
                overflow: hidden;
            }
            .nav-container{
                position: absolute;
                bottom:0px;
            }
            .nav-container a{
                text-decoration: none;
            }
            .nav{
                display: table;
                position: relative;
                float:left;
                float:left;
                 20%;
                height: 30px;
                text-align: center;
                z-index:2;
            }
            .nav:hover a{
                background-color: gray;
            }
            .nav a{
                display: table-cell;
                vertical-align: middle;
                100%;
                height:100%;
                color:white;
                background-color: lightgray;
                font-size: 20px;
            }
            .nav input{
                display: inline-block;
                 100%;
                height: 28px;
                opacity: 0;
                position: absolute;
            }
            input:checked + em {
                position: absolute;
                left: 50%;
                margin-left: -20px;
                margin-top: -20px;
                 1px;
                border-left: 20px solid transparent;
                border-right: 20px solid transparent;
                border-bottom: 20px solid gray;
            }
            input:checked ~ a {
                background-color: gray;
            }
            .page-container{
                position: fixed;
                100%;
                top:0px;
                bottom:0px;
            }
            .show-container{
                position: absolute;
                100%;
                height:500%;
            }
            section{
                100%;
                height:20%;
            }
            img{
                100%;
                height:100%;
            }
        </style>
    </head>
    <body>
        <div class="nav-container">
            <div id="nav1" class="nav">
                <input id="r1" name="nav" type="radio" checked="checked"/>
                <em class="triangle"></em>
                <a href="javascript:;">医疗</a>
            </div>
            <div id="nav2" class="nav">
                <input id="r2" name="nav" type="radio" />
                <em class="triangle"></em>
                <a href="javascript:;">卫生</a>
            </div>
            <div id="nav3" class="nav">
                <input id="r3" name="nav" type="radio" />
                <em class="triangle"></em>
                <a href="javascript:;">食品</a>
            </div>
            <div id="nav4" class="nav">
                <input id="r4" name="nav" type="radio" />
                <em class="triangle"></em>
                <a href="javascript:;">旅游</a>
            </div>
            <div id="nav5" class="nav">
                <input id="r5" name="nav" type="radio" />
                <em class="triangle"></em>
                <a href="javascript:;">教育</a>
            </div>
            <div class="page-container">
                <div class="show-container">
                    <section id="sec1" class="show-sec">
                        <img src="images/1.jpg" />
                    </section>
                    <section id="sec2" class="show-sec">
                        <img src="images/2.jpg" />
                    </section>
                    <section id="sec3" class="show-sec">
                        <img src="images/3.jpg" />
                    </section>
                    <section id="sec4" class="show-sec">
                        <img src="images/4.jpg" />
                    </section>
                    <section id="sec5" class="show-sec">
                        <img src="images/5.jpg" />
                    </section>
                </div>
            </div>
        </div>
        <script src="jquery-2.0.3.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("input").on("click", function(){
                    var index = parseInt(this.id[1]);
                    var viewHeight = $(".page-container").height();
                    var top = -(index-1)*viewHeight;
                    $(".show-container").animate({top:top+"px"},800);
                });
            });
        </script>
    </body>
    </html>
    

      

  • 相关阅读:
    齐次和线性
    数组指针/指针数组
    坐标转换矩阵
    【转】GMM与K-means聚类效果实战
    利用虚函数实现多态的方式:动态绑定
    类型限定符volatile
    《剑指offer》查找二维数组内元素 c++
    windows下使用命令行编译、链接C++源文件
    关于该博客的美化
    vimium快捷键修改
  • 原文地址:https://www.cnblogs.com/chengshuiqiang/p/4738110.html
Copyright © 2011-2022 走看看