Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议增加一个滚动的公告栏 #232

Open
infanx opened this issue Mar 2, 2022 · 0 comments
Open

建议增加一个滚动的公告栏 #232

infanx opened this issue Mar 2, 2022 · 0 comments

Comments

@infanx
Copy link

infanx commented Mar 2, 2022

index.ftl 里的 12 - 19 行

        <div class="notice" style="
	<#if (settings.focus_height!true)>
		margin-top: 20px;
	</#if>
		">
		<i class="iconfont icon-broadcast"></i>
		<div class="notice-content">${settings.notice_title!}</div>
	</div>

稍微魔改亿下

	<div class="notice" style="
	<#if (settings.focus_height!true)>
		margin-top: 20px;
	</#if>
		">
		<i class="iconfont icon-broadcast"></i>
		<#--  <div class="notice-content">${settings.notice_title!}</div>  -->
		<style>
			.notice-content {
				margin-top: -22px;
				float: left;
				width: 90%;
				height: 70px;
				overflow: hidden;
			}
			.textA {
				text-decoration: none;
				display: block;
				height: 40px;
				line-height: 40px;
				color: transparent;
				transition: all 2s;
			}
			.textA:first-child {
				margin-top: -47px;
			}
			.textA:nth-child(2) {
				color: #696969;
			}
		</style>
		<div class="notice-content">
			${settings.notice_title!}
		</div>
		<script>
			setInterval(function(){document.getElementsByClassName("notice-content")[0].appendChild(document.querySelector('.textA'));},8000);
		</script>
	</div>

其中,${settings.notice_title!}内容是

<p class="textA">我是第一条公告</p>
<p class="textA">我是第二条公告</p>
<p class="textA">我是第三条公告</p>
<p class="textA">我是第四条公告</p>

这样可以实现滚动的公告栏
停留时长可以更改script里的时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant