zoukankan      html  css  js  c++  java
  • 妙味——手风琴效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <style>
    *{margin: 0;padding: 0;}
    .show-box{width: 600px;height: 300px;border: 1px solid #ccc;margin: 50px auto 0;overflow: hidden;}
    #accordion{width: 600px;height: 300px;position: relative;left: 0;top: 0;}
    #accordion li{width: 600px;height: 300px;position: absolute;top: 0;list-style-type: none;}
    .no1{background-color: #0099FF}
    .no2{background-color: #00CCFF}
    .no3{background-color: #00FFFF}
    .no4{background-color: #00FF33}
    .no5{background-color: #FF99CC}
    </style>
    <script src="http://files.cnblogs.com/baixc/move.js" charset="utf-8"></script>
    <script>
    window.onload=function()
    {
        var oUl=document.getElementById('accordion');
        var aLi=oUl.getElementsByTagName('li');
        var _width=aLi[0].offsetWidth;
        var i=0;
    
        // alert(_width);
    
        for(i=1;i<aLi.length;i++)
        {
            aLi[i].style.left=(_width-200)+(i-1)*50+'px';
        }
    
        for(i=0;i<aLi.length;i++)
        {
            aLi[i].index=i;
            aLi[i].onmouseover=function()
            {
                for(i=0;i<aLi.length;i++)
                {
                    if(i <= this.index)
                    {
                        startMove(aLi[i],{left:i*50});
                    }
                    else
                    {
                        startMove(aLi[i],{left:(_width-200)+(i-1)*50});
                    }
                }
            };
        }
    }
    </script>
    </head>
    <body>
        <div class="show-box">
            <ul id="accordion">
                <li class="no1">1</li>
                <li class="no2">2</li>
                <li class="no3">3</li>
                <li class="no4">4</li>
                <li class="no5">5</li>
            </ul>
        </div>
    </body>
    </html>

     效果如下图所示:

    高否?富否?帅否? 否? 滚去学习!
  • 相关阅读:
    recess----2.Controller里面取用request信息
    recess----1.第一个APP-helloRecess
    Introducing MVC
    IFA Basics
    Why do Antennas Radiate?
    [JSP]JSP 简介
    [Spring]04_最小化Spring XML配置
    [设计模式]创建型模式
    [设计模式]原型模式
    [设计模式]建造者模式
  • 原文地址:https://www.cnblogs.com/baixc/p/3508079.html
Copyright © 2011-2022 走看看