AI 太方便了,告诉他怎么做,分分钟搞定,哈哈哈。
代码如下,鼠标移动到帖子区域才显示预览按钮了。
/* 预览按钮:极简、彩色、紧凑 */ .libra-preview-btn { display: inline-block !important; width: max-content !important; height: auto !important; padding: 1px 4px !important; margin-left: 3px !important; font-size: 11px !important; font-weight: bold; line-height: 1.2 !important; cursor: pointer; /* 渐变彩色背景 */ background: linear-gradient(135deg, #6e8efb, #a777e3); color: white !important; border-radius: 3px; border: none; white-space: nowrap; vertical-align: baseline; box-shadow: 0 1px 3px rgba(110, 142, 251, 0.3); /* --- 新增:默认隐藏并增加平滑过渡 --- */ opacity: 0; transition: opacity 0.2s ease-in-out; pointer-events: none; /* 隐藏时不可点击,防止误触 */ } /* --- 新增:当鼠标移动到包含标题的容器时,显示按钮 --- */ /* 这里假设 2libra 的帖子容器包含 title-link,我们通过父级状态控制子级 */ div:hover > a.title-link .libra-preview-btn, a.title-link:hover .libra-preview-btn { opacity: 1; pointer-events: auto; } /* 遮罩层 */ #libra-preview-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); z-index: 999998; } /* 弹窗容器 */ #libra-preview-modal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 85vw; height: 85vh; background: #fff; z-index: 999999; flex-direction: column; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; } .libra-modal-header { padding: 10px 20px; background: #fdfdfd; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; } .libra-modal-title { font-weight: bold; color: #555; font-size: 13px; } .libra-close-btn { cursor: pointer; font-size: 12px; color: #999; padding: 2px 8px; border: 1px solid #eee; border-radius: 4px; } #libra-preview-iframe { flex: 1; width: 100%; border: none; }
果然有相关插件了,去安装一下试试,谢谢大佬了
点击预览窗外的位置,可以关闭预览。