LLWiki正在建设中,欢迎加入我们

MediaWiki:Gadget-toc-custom.css

来自LLWiki
跳转到导航 跳转到搜索

注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件
.toc-custom {
	position: fixed;
	z-index: 1000; /* 高于所有静态元素 */
	right: 0;
	top: 50vh;
	transform: translate(100%, -50%); /* 绝对居中,下同 */
	background-color: rgba(255,255,255,0.9);
	max-width: 300px;
	transition: all 0.2s ease-in;
	padding: 7px 0 7px 7px;
}
.toc-custom:hover {
	transform: translate(0, -50%);
	box-shadow: 0 0 4px #000;
}
.toc-custom::before {
	content: attr(data-content); /* 为了繁简转换 */
	box-sizing: border-box;
	width: 22px;
	position: absolute;
	left: -22px;
	top: 50%;
	transform: translateY(-50%);
	padding: 15px 0; /* 水平padding不影响居中即可 */
	text-align: center;
	font-size: 12px;
	background-color: #000;
	color: #fff;
	opacity: 0.5;
	transition: opacity 0.2s ease-in;
	cursor: pointer;
	box-shadow: 0 0 4px #000;
}
.skin-minerva .toc-custom::before {
	content: '\f15c';
	font-family: 'Font Awesome 5 Free';
	width: 54px;
	left: -27px;
	padding: 9px;
	text-align: left;
	font-size: 18px;
	line-height: 2;
	border-radius: 50%;
	z-index: -1;
}
.toc-custom:hover::before {
	opacity: 0; /* 不使用diplay: none避免突兀 */
}
.skin-minerva .toc.toc-custom > .toctitle {
	visibility: visible;
	text-align: center;
}
#mw-content-text .toc-custom > ul {
	max-height: 30vh;
	overflow-y: scroll; /* 这里不能用auto */
	margin: 0.3em 0;
	padding: 0 7px 0 0; /* 把右侧padding改到滚动条内侧 */
}
.skin-minerva .toc-custom li {
	margin-bottom: 0.1em;
}
.client-js .skin-minerva .toc-custom .tocnumber {
	display: inline;
}
.toc-custom > .toctitle > .mw-ui-icon, /* 手机版 */
.toc-custom .toctogglespan,
.toc-custom .toctoggle { /* 个别情况下会冒出一个 .toctoggle */
	display: none;
}
/* [[category:CSS小工具]] [[category:桌面版小工具]] [[category:阅读工具]] [[category:默认开启的小工具]] */
/* {{DEFAULTSORT:toc-custom.css}} */