JS網頁特效操作流程——下拉式功能表列表與登入註冊彈窗效果

來源:互聯網
上載者:User

標籤:cursor   pointer   setattr   osi   head   操作   one   流程   add   

  下拉式功能表列表

<style>
        *{
            margin: 0px;
            padding: 0px;
        }
        .menu{
            width: 1100px;
            height: 30px;
            background-image: url(img/魅力羅蘭Music炫圖18.jpg);
            margin-left: 200px;
            margin-top: 50px;
        }
        .btn{
            width: 183.3px;
            height: 30px;
            float: left;
            text-align: center;
            line-height: 30px;
            font-size: 14px;
            position: relative;
            overflow: hidden;
            transition: 0.5s;
        }
        .btn:hover{
            cursor: pointer;
            background-color: burlywood;
            color: white;
            max-height: 200px;
            overflow: visible;
        }
        .btn ul{
            list-style: none;
            background-color: #008000;
        }
        
    </style>
    
    <body>
        <div class="menu">
            <div class="btn">羅蘭首頁</div>
            <div class="btn">歌曲專欄
                <ul>
                    <li>流行</li>
                    <li>搖滾</li>
                    <li>藍調</li>
                    <li>民謠</li>
                </ul>
            </div>
            <div class="btn">音樂人專欄
                <ul>
                    <li>內地</li>
                    <li>歐美</li>
                    <li>日韓</li>
                    <li>港台</li>
                </ul>
            </div>
            <div class="btn">樂器專欄
                <ul>
                    <li>鋼琴</li>
                    <li>小提琴</li>
                    <li>吉他</li>
                    <li>架子鼓</li>
                </ul>
            </div>
            <div class="btn">戲曲專欄
                <ul>
                    <li>京劇</li>
                    <li>話劇</li>
                    <li>豫劇</li>
                    <li>黃梅戲</li>
                </ul>
            </div>
            <div class="btn">魅力ROLAND體驗區
                <ul>
                    <li>新曲</li>
                    <li>唱片</li>
                    <li>MV</li>
                </ul>
            </div>
        </div>
        
    </body>


登入註冊彈窗效果

<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            * {
                margin: 0px;
                padding: 0px;
            }
            
            .login {
                width: 100px;
                height: 30px;
                font-size: 25px;
                line-height: 30px;
                border: 1px solid black;
                text-align: center;
                background-color: darkcyan;
                color: white;
            }
            
            .login:hover {
                cursor: pointer;
                background-color: greenyellow;
            }
            
            .mask {
                width: 100%;
                background-color: black;
                opacity: 0.5;
                position: absolute;
                top: 0px;
                left: 0px;
                z-index: 90;
            }
            
            .log-div {
                width: 500px;
                height: 300px;
                background-color: white;
                position: fixed;
                z-index: 99;
            }
        </style>
    </head>

    <body>
        <div class="mask" hidden></div>
        <div class="log-div" hidden="hidden"></div>
        <div class="login">登 錄</div>
        <p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p>
        <p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p>
        <p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p>
        <p>123</p><p>123</p><p>123</p><p>123</p><p>123</p><p>123</p>


    </body>

</html>

<script>
    var mask = document.getElementsByClassName("mask")[0];
    var login = document.getElementsByClassName("log-div")[0];
    var btn = document.getElementsByClassName("login")[0];

    var clientWidth = document.body.clientWidth;
    var clientHeight = document.documentElement.clientHeight;

    login.style.left = clientWidth / 2 - 250 + "px";
    login.style.top = clientHeight / 2 - 150 + "px";
    
    mask.style.height = document.body.clientHeight + "px";

    window.onresize = function() {
        var clientWidth = document.body.clientWidth;
        var clientHeight = document.documentElement.clientHeight;

        login.style.left = clientWidth / 2 - 250 + "px";
        login.style.top = clientHeight / 2 - 150 + "px";
    }
    
    btn.onclick = function(){
        mask.removeAttribute("hidden");
        login.removeAttribute("hidden");
    }
    
    mask.onclick = function(){
        mask.setAttribute("hidden","");
        login.setAttribute("hidden","hidden");
    }
</script>

JS網頁特效操作流程——下拉式功能表列表與登入註冊彈窗效果

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.