左側のスライドメニューの一部やコンテンツのスクロールバーを追加するためのHTMLページ

HTML + CSS + jQueryの

 ソースアドレス:https://gitee.com/migloo/sliderdrawer

アイデア:

  1、方法のjqueryのアニメーションによってメニューメニュースライドを滑り達成

  ページの左側にデフォルトは可視光領域でない2、メニューメニューに対して設定、

  3、イベントをクリックすることで、アニメーションを呼び出すには、スライド式のメニューの中にスライドします

次のようなスタイルは、次のとおりです。

次のように表示パターンの固定サイズの領域である特定します。

                 

コードは以下の通りであります:

 

body {
    width: 100vw;
    height: 100vh;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background: #FFEBCD;
}

body>div {
    width: 360px;
    height: 640px;
    border: 3px groove blanchedalmond;
    border-radius: 8px;
    background: #f1f1f1;
    padding: 5px;
    overflow: hidden;
}

.page {
    width: 500px;
    height: 100%;
    display: flex;
    flex-direction: row;
    position: relative;
    left: -140px;
}

.content {
    height: 100%;
    width: 360px;
    display: flex;
    flex-direction: column;
}

.content>img {
    margin-top: 15px;
    margin-left: 10px;
    cursor: pointer;
    height: 26px;
    width: 32px;
}

.content>div {
    flex-grow: 1;
    overflow: auto;
    padding: 5px;
    font-size: 2em;
    -webkit-overflow-scrolling: touch;    
}

.menu {
    height: 100%;
    width: 120px;
    margin-right: 20px;
    display: flex;
    flex-direction: column;
}

.menu>div {
    margin: 5px 0 10px 5px;
}

 

 

设置自动适应全部网页空间的样子如下:

      

 

 

 

 

        <style type="text/css">
            body {
                padding: 0;
                margin: 0;
                width: 100vw;
                height: 100vh;
                display: flex;
                justify-content: center;
                align-items: center;
                overflow: hidden;
            }

            .page {
                width: 100%;
                height: 100%;
                overflow: hidden;
            }

            .container {
                position: relative;
                left: -200px;
                width: calc(100% + 200px);
                height: 100%;
                display: flex;
                flex-direction: row;
            }

            .menu {
                width: 200px;
                height: 100%;
                background: linear-gradient(white, black);
            }

            .scroll {
                flex-grow:1;
                height: 100%;
                overflow: auto;
                -webkit-overflow-scrolling: touch;
            }
            .content {
                width: 100%;
                height: 300%;
                background: linear-gradient(black, white);
            }
        </style>

 

おすすめ

転載: www.cnblogs.com/janken/p/11459293.html
おすすめ