1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
tools/index.html

99 lines
2.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微博热搜</title>
<style>
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
overflow: hidden;
}
.container {
display: grid;
grid-template-rows: 1fr 50px;
width: 100%;
height: 100%;
}
iframe {
width: 100%;
height: 100%;
}
#float-container.bt {
bottom: 0;
right: 0;
left: 0;
height: 100%;
background-color: #fdfdfd;
box-shadow: 0 -2px 10px 0 rgb(0 0 0 / 10%);
display: grid;
grid-template-columns: repeat(2, 1fr);
place-items: center;
}
#float-container.bt .navbar-item {
text-align: center;
cursor: pointer;
width: 80px;
user-select: none;
}
#float-container.bt .navbar-item .navbar-image {
width: 22px;
height: 22px;
filter: grayscale(1);
}
#float-container.bt .navbar-item .navbar-title {
font-size: 11px;
color: #666;
margin-top: -3px;
}
#float-container.bt .navbar-item.active .navbar-image {
filter: initial;
}
</style>
</head>
<body>
<div class="container">
<iframe src="html/weibo.html" frameborder="0" style=""></iframe>
<div id="float-container" class="bt">
<div class="navbar-item active" targetPage="html/weibo.html">
<img class="navbar-image" src="./html/assets/image/weibo.svg" />
<p class="navbar-title">微博</p>
</div>
<div class="navbar-item" targetPage="html/bilibili.html">
<img class="navbar-image" src="./html/assets/image/bilibili.svg" style="transform: scale(0.84);" />
<p class="navbar-title">B站</p>
</div>
</div>
</div>
<script>
let navbarItems = document.querySelectorAll('.navbar-item');
let iframe = document.querySelector('iframe');
navbarItems.forEach(item => {
item.addEventListener('click', () => {
navbarItems.forEach(item => {
item.classList.remove('active');
});
item.classList.add('active');
iframe.src = item.getAttribute('targetPage');
});
});
</script>
</body>
</html>