模拟手机拖动效果

代码语言:html

所属分类:拖放

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> Flicking examples iphone</title>
    <style>

        body {
            background: #26A478;
        }
        .iphone {
            position: absolute;
            width: 200px;
            height: 400px;
            border-radius: 20px;
            background: #fff;
            box-shadow: rgba(100, 100, 100, 0.4) 5px 5px;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;
        }
        .iphone .container {
            position: absolute;
            width: calc(100% - 10px);
            height: calc(100% - 100px);
            background: transparent;
            border: 2px solid #ddd;
            border-radius: 5px;
            left: 0;
            right: 0;
            margin: auto;
            bottom: 52px;
            overflow: hidden;
        }
        .iphone .head {
            position: absolute;
            width: 36px;
            height: 8px;
            top: 22px;
            left: 0;
            right: 0;
            border-radius: 4px;
            margin: auto;
            background: #ddd;
        }
        .iphone .home {
            position: absolute;
            width: 36px;
            height: 36px;
            border: 2px solid #ccc;
            border-radius: 50%;
            bottom: 6px;
            left: 0;
            right: 0;
            margin: auto;
        }

        .iphone .panels {
            position: relative;
            top: 0;
            width: 100%;
            height: 77%;
        }
        .iphone .panel {
            position: relative;
            width: 100%;
            height: 100%;
            padding-top: 2px;
            box-sizing: border-box;
        }
        .bottom {
            position: relative;
        }
        .panel, .dock, .pagination {
            text-align: center;
            font-size: 0;
        }
        .pagination {
            display: block;
            width: 100%;
            padding: 6px 0px 0px 0px;
        }
        .pagination .dot {
            display: inline-block;
            width: 7px;
            height: 7px;
            border-radius: 5px;
            background: rgba(160, 160, 160, 0.4);
            margin: 0px 4.5px;
        }
        .pagination .dot.selected {
            background: rgba(160, 160, 160, 0.9);
        }
        .dock {
            padding-top: 3px;
        }
        .icon {
            display: inline-block;
            background: #f55;
            width: 35px;
            height: 35px;
            border-radius: 5px;
            margin: 5.5px 4.5px;
        }
        .panel .info {
            position: relative;
            height: 300px;
        }
        .panel .widgets {
            position: relative;
            overflow: auto;
            height: 300px;
            padding: 40px 5px 0px 5px;
            box-sizing: border-box;
        }

        .widget {
            border-radius: 5px;
            height: 100px;
            background: rgba(220, 220, 220, 0.6);
            margin-bottom: 5px;
            overflow: hidden;
        }
        .search {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            background: rgba(220, 220, 220, 0.5);
            z-index: 2;
            box-sizing: border-box;
        }
        .search-box {
            position: relative;
            border-radius: 5px;
            background: rgba(210, 210, 210, 0.6);
            height: 26px;
            line-height: 26px;
            margin: 5px;
            font-size: 11px;
            text-align: left;
            padding-left: 5px;
            box-sizing: border-box;
        }
        .widget * {
            vertical-align: middle;
        }
        .widget .i, .search-box .i {
            margin-right: 4px;
            vertical-align: middle;
        }
        .widget .title {
            font-size: 11px;
            color: #512003;
            text-align: left;
            padding: 5px;
            box-sizing: border-box;
            background: rgba(210, 210, 210, 0.4);
        }
        .edit {
            position: relative;
            margin: 20px auto 10px;
            width: 40px;
            height: 40px;
            line-height: 40px;
            font-size: 11px;
            color: #777;
            text-align: center;
            background: rgba(210, 210, 210, 0.4);
            border-radius: 50%;
        }

        .icon:nth-child(6n + 1) {
            background: #FDBC65;
        }
        .icon:nth-child(6n + 2) {
            background: #8F7BB8;
        }
        .icon:nth-child(6n + 3) {
            background: #29C9FF;
        }
        .icon:nth-child(6n + 4) {
            background: #2688CB;
        }
        .icon:nth-child(6n + 5) {
            background: #f55;
        }
        .icon:nth-child(6n) {
            background: #7FD33F;
        }
    </style>
    <script>
        window.console = window.console || function(t) {};
    </script>
    <script>
        if (document.location.search.match(/type=embed/gi)) {
            window.parent.postMessage("resize", "*");
        }
    </script>
</head>
<body translate="no">
    <div class="iphone">
        <div class="head"></div>
        <div class="home"></div>
        <div class="container">
            <div class="panels">
                <div class="panel info">
                    <div class="search">
                        <div class="search-box">
                            <span class="i">🔍</span> Search...
                        </div>
                    </div>
                    <div class="widgets">
                        <div class="widget">
                            <div class="title">
                                <span class="i">📝</span>
                                Memo
                            </div>
                        </div>
                        <div class="widget">
                            <div class="title">
                                <span class="i">🔋</span> Battery
                            </div>
                        </div>
                        <div class="widget">
                            <div class="title">
                                <span class="i">⏳</span> Screen Time
                            </div>
                        </div>
                        <div class="edit">
                            Edit
                        </div>
                    </div>
                </div>
                <div class="panel">
                    <div class="icon"></div>
                    <div class="icon"></div>
                    <div class="icon"></div>
                    <div class="icon"></div>
                    <div class="icon"></div>
                    <div cl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0