子比主题 – 仿网红路牌风格小工具代码

简介

还原线下网红路牌样式,支持自定义地点名称、标语、方向箭头、配色,自带阴影、倾斜质感,适配 PC + 移动端,和子比主题风格兼容。

效果展示

代码部署

<!-- 引入图标库(必须加,否则左右箭头不显示) -->
<link rel="stylesheet" href="http://127.0.0.1/font-awesome.min.css">

<style>
.guizhou-board {
  width: 100% !important;
  max-width: 100% !important;
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-family: "Microsoft Yahei", sans-serif;
  background-color: #fff;
  box-sizing: border-box;
}
.board-top {
  background-color: #0052d9;
  color: #fff;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  line-height: 1.2;
  box-sizing: border-box;
  height: 60px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}
.board-bottom {
  display: flex;
  align-items: center;
  background-color: #f8f9fa;
  padding: 10px 5px;
  justify-content: space-between;
  box-sizing: border-box;
}
.dir-btn {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  padding: 5px 8px;
  border-radius: 4px;
  transition: color 0.2s;
  line-height: 1;
  flex-shrink: 0;
}
.dir-btn:hover {
  color: #0052d9;
}
.dir-icon {
  font-size: 12px;
  margin: 0 !important;
}
.west-btn .dir-icon {
  margin-right: 5px !important;
}
.east-btn .dir-icon {
  margin-left: 5px !important;
}
.station-text {
  text-align: center;
  font-size: 14px;
  flex: 1;
  margin: 0 10px;
}
.station-text a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
  display: inline-block;
}
.station-text a:hover {
  color: #0052d9;
  text-decoration: underline;
}
</style>

<div class="guizhou-board">
  <div class="board-top" id="boardText">我在这里很想你</div>
  <div class="board-bottom">
    <button class="dir-btn west-btn" onclick="changeText('west')">
      <i class="fa dir-icon fa-chevron-left"></i> 西
    </button>
    <div class="station-text">
      <a href="https://pinpinping.cn" target="_blank" rel="noopener noreferrer"> A0Y.CN</a>
    </div>
    <button class="dir-btn east-btn" onclick="changeText('east')">
      东 <i class="fa dir-icon fa-chevron-right"></i>
    </button>
  </div>
</div>

<script>
// 文案数组(修复了乱码空格)
const textMap = {
  west: [
    '想你的风又吹到了这里',
    '给我充个VIP',
    '我建网站养你',
    '等我!好不得!'
  ],
  east: [
    '我在闲云笔记等你',
    '源码都在这里',
    '这是一个子比主题',
    '我在这里你在哪里'
  ]
};
let westIndex = 0, eastIndex = 0;
function changeText(direction) {
  const boardText = document.getElementById('boardText');
  if (direction === 'west') {
    boardText.textContent = textMap.west[westIndex];
    westIndex = (westIndex + 1) % textMap.west.length;
  } else {
    boardText.textContent = textMap.east[eastIndex];
    eastIndex = (eastIndex + 1) % textMap.east.length;
  }
}
</script>
百度网盘
来源:百度网盘 | 提取码: drrj
立即下载
上一篇 子比主题美化 – 站点数据统计条代码