模仿iphone苹果手机浏览器Safari 多选项卡效果

代码语言:html

所属分类:视觉差异

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
.fake-text {
    width: 80%;
    height: 6px;
    background-color: rgba(220, 216, 216, 0.6);
    margin: 4px 0;
    border-radius: 8px;
}

.fake-text-gap {
    margin-bottom: 8px;
}

.fake-picture {
    width: 100%;
    height: 40%;
    background-color: rgba(220, 216, 216, 0.6);
    margin: 16px 0;
    border-radius: 12px;
}

.fake-list {
    font-size: 14px;
    margin: 16px 0;
}

.list-bullet-ul, .list-bullet-ol {
    margin-bottom: 8px;
    display: grid;
    grid-gap: 4px;
    grid-auto-flow: row;
    grid-template-columns: 20px 1fr;
    justify-content: center;
    align-items: center;

}

.list-bullet-ul > div:nth-of-type(1) {
    width:  6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(220, 216, 216, 0.6);
    margin: 0 8px;
}

.list-bullet-ol > div:nth-of-type(1) {
    color: rgba(220, 216, 216, 0.6);
    font-size: 12px;
    text-align: center;
    margin-left: 2px;
}


.fake-list-item {
    width: 60%;
    height: 6px;
    background-color: rgba(220, 216, 216, 0.6);
    border-radius: 8px;
}

.fake-grid {
    margin: 16px 0;
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 8px;
}

.fake-grid > div {
    height: 60px;
    background-color: rgba(220, 216, 216, 0.6);
    border-radius: 8px;
}

:root {
    --bottom-controls-bgc: rgb(58, 58, 58);
    --bottom-controls-fgc: rgb(71, 148, 242);
}

body {
    margin: 0;
    background-color: black;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.display-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0px 0px;
}


.the-display {
    overflow: hidden;
    position: relative;
}

.browser-tab-normal {
    box-sizing: border-box;
    transition: transform 0.4s ease-out;
    transform-origin: 50% 50%;
    position: absolute;
    top: 0;
    left: 0;
}

.bottom-control-panel {
    height: 65px;
    background-color: var(--bottom-controls-bgc);
    position: fixed;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bt-panel-tab, .bt-panel-menu {
    width: calc(100% - 32px);
    height: 100%;
    display: flex;
    position: absolute;
    top: 0;
    left: 16px;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    transition: opacity 400ms linear;
}

.bottom-control-button {
    width: 35px;
    height: 35px;
    padding: 0;
    background-color: transparent;
    border: none;
    outline: none;
    user-select: none;
    position: relative;
    /* background-color: lightpink; */
    /* filter: drop-shadow(0px 0px 3px var(--bottom-controls-fgc)); */
}

.bottom-menu-text {
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.tab-closer {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background-color: rgba(100, 100, 100, 1);
    transition: opacity 200ms ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tab-closer-button {
    width: 12px;
    height: 12px;
    position: absolute;
    top: 4px;
    left: 4px;
    background-color: transparent;
    border: none;
}

.content-container {
    padding: 16px;
    box-sizing: border-box;
}

.tab-title {
    color:white;
    font-size: 14px;
}
</style>

</head>
<body translate="no">
<div class="display-wrapper">
<div class="the-display">
</div>
<div class="bottom-control-panel">
<div class="bt-panel-tab">

<button class="bottom-control-button" onclick="displayTabs()">
<div style="position:absolute;width:50%;height:50%;border:1px solid var(--bottom-controls-fgc);border-radius:15%;background-color:var(--bottom-controls-bgc);top:10%;left:10%;"></div>
<div style="position:absolute;width:50%;height:50%;border:1px solid var(--bottom-controls-fgc);border-radius:15%;background-color:var(--bottom-controls-bgc);bottom:10%;right:10%;"></div>
</button>
<div class="bottom-control-button" style="position:relative;user-select:none;" onclick="onUnimplemented()">
<div style="position:absolute;top:25%;left:20%;height:50%;width:1px;background-color:var(--bottom-controls-fgc);"></div>
<div style="position:absolute;top:25%;left:49%;height:50%;width:1px;background-color:var(--bottom-controls-fgc);"></div>
<div style="position:absolute;top:25%;left:78%;height:50%;width:1px;background-color:var(--bottom-controls-fgc);"></div>

<div style="user-select:none;position:absolute;top:8%;left:20%;width:30%;height:30%;border-radius:50%;overflow-y:hidden;">
<div style="user-select:none;position:absolute;top:40%;left:-4%;width:100%;height:100%;border-radius:50%;border:1px solid var(--bottom-controls-fgc);"></div>
</div>
<div style="user-select:none;position:absolute;top:8%;left:51%;width:30%;height:30%;border-radius:50%;overflow-y:hidden;">
<div style="user-select:none;position:absolute;top:40%;left:-4%;width:100%;height:100%;border-radius:50%;border:1px solid var(--bottom-controls-fgc);"></div>
</div>

<div style="position:absolute;top:55%;left:20%;width:30%;height:30%;border-radius:50%;overflow-y:hidden;">
<div style="position:absolute;top:40%;left:-4%;width:100%;height:100%;border-radius:50%;border:1px solid var(--bottom-controls-fgc);"></div>
</div>
<div style="position:absolute;top:55%;left:51%;width:30%;height:30%;border-radius:50%;overflow-y:hidden;">
<div style="position:absolute;top:40%;left:-4%;width:100%;height:100%;border-radius:50%;border:1px solid var(--bottom-controls-fgc);"></div>
</div>
</div>

<div class="bottom-control-button" style="position:relative;" onclick="onUnimplemented()">

<div style="position:absolute;left:25%;top:25%;width:50%;height:50%;border: 1px solid var(--bottom-controls-fgc);border-radius:15%;"></div>

<div style="width:25%;height:25%;background-color:var(--bottom-controls-bgc);position:absolute;top:17%;left:40%;"></div>

<div style="transform:rotateZ(90deg);transform-origin:0% 50%;width:50%;height:1px;background-color:var(--bottom-controls-fgc);position:absolute;  top:2%;left:calc(50% + 1px);"></div>
<div style="transform:rotateZ(45deg);transform-origin:0% 50%;width: 18%;height:1px; background-color:var(--bottom-controls-fgc);position:absolute;top:2%;left:calc(50% + 1px);"></div>
<div style="transform:rotateZ(135deg);transform-origin:0% 50%;width:18%;height:1px; background-color:var(--bottom-controls-fgc);position:absolute;top:2%;left:calc(50% + 1px);"></div>
</div>
<div class="bottom-control-button" style="position:relative;" onclick="reloadTab()">
<div style="width:50%;height:1px;background-color:var(--bottom-controls-fgc);position:absolute;top:50%;left:50%;transform:translateX(50%) rotateZ(140deg);transform-origin:0 50%;"></div>
<div style="width:50%;height:1px;background-color:var(--bottom-controls-fgc);position:absolute;top:50%;left:50%;transform:translateX(50%) rotateZ(220deg);transform-origin:0 50%;"></div>
</div>
<div class="bottom-control-button" style="position:relative;" onclick="reloadTab()">
<div style="width:50%;height:1px;background-color:var(--bottom-controls-fgc);position:absolute;top:50%;left:50%;transform:translateX(-50%) rotateZ(40deg);transform-origin:0 50%;"></div>
<div style="width:50%;height:1px;background-color:var(--bottom-controls-fgc);position:absolute;top:50%;left:50%;transform:translateX(-50%) rotateZ(-40deg);transform-origin:0 50%;"></div>
</div>
</div>
<div class="bt-panel-menu" style="display:none;">
<div class="bottom-menu-text" onclick="done()">Done</div>
<div onclick="openNewTab()" style="position:relative;width:26px;height:26px;">
<div style="position:absolute;top:50%;left:20%;width:60%;height:1px;background-color:white;"></div>
<div style="position:absolute;top:50%;left:20%;width:60%;height:1px;background-color:white;transform:rotateZ(90deg);"></div>
</div>
<div class="bottom-menu-text" onclick="onUnimplemented()">Private</div class="bottom-menu-text">
</div>
</div>
</div>

<script>

const CROSS_DIV = `
    <div style="position:absolute;top:50%;left:0%;width:100%;height:1px;background-color:white;transform:rotateZ(45deg);transform-origin:50% 50%;"></div>
    <div style="position:absolute;top:50%;left:0%;width:100%;height:1px;background-color:white;transform:rotateZ(-45deg);transform-origin:50% 50%;"></div>
`;

const TAB_COLORS = [
    '#e817a4',
    '#33CC75',
    '#4B7FB4',
    '#C53A54',
    '#40BFB0',
    '#308F84',
    '#8F303B',
    '#BD29A8',
    '#6f716f',
    '#E6B919',
    '#EE9111',
    '#E30BF1',
];



function fillWithFakeContent(contentContainer, amountOfFakeContent) {
    for (let i = 0; i < amountOfFakeContent; i++) {
        const rand = Math.floor(Math.random() * 100);
            if (rand < 50) {
                const n = Math.floor(Math.random() * 8 + 3);
                for (let i = 0; i < n; i++) {
                    const element = document.createElement('div');
                    const width = Math.random() * 30 + 70;
                    element.style.width = `${width}%`;
                    element.className = 'fake-text' + (i !== 0 && i % 4 === 0 ? ' fake-text-gap' : '');
                    contentContainer.appendChild(element);
                }
            } else if (rand < 70) { // pictures
                const element = document.createElement('div');
                element.className = 'fake-picture';
                const randomHeight = Math.floor(Math.random() * 10 + 20);
                elem.........完整代码请登录后点击上方下载按钮下载查看

网友评论0