新闻上滚动html

标题 新闻上滚动无缝连接切换-HTML

css样式##

/*新闻动态样式begin*/
.notice_active{
	float: left;
	width: 100%;
	height: 42px;
	overflow: hidden;
	position: relative;
	box-sizing: border-box;
	white-space: nowrap;
	text-overflow: ellipsis;
	background-color: rgb(229,245,252);
	margin-top: 20px;
}
.notice_active>ul>li{
	line-height: 42px;
	display: flex;
	align-items: center;
	font-size: 16px;
}
.notice_active>ul>li>img{
	width: 0.4rem;
	margin-right: 0.2rem;
}
.tooLength{
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	display: block;
}

html模板

<!--新闻动态begin-->
<div class="notice_active">
	<ul>
		<li v-for="item,index in informationDynamicsList">
			<span style="margin-left: 12px;width: 80px;">
				<a style="color:#00a0e9;" href="/information/infodynamics-list">资讯动态:</a>
			</span>
			<span style="width: 84px;color:#939393;" v-html="item.infoPublishTime"></span>
			<span style="margin:0 24px;width: 767px;">
				<a class="tooLength" target="_blank" :href="'/information/information-detail?infoId='+item.id" style="color: #4a4a4a;" v-html="item.title"></a>
			</span>
			<span style="float: right;text-align: right;">
				<a style="color:#00a0e9;text-decoration: underline;" href="/information/infodynamics-list">查看更多&gt;&gt;&gt;</a>
			</span>
		</li>
	</ul>
</div>
<!--新闻动态end-->

JS模块

//新闻动态上下滚动
//3.方法
function t() {
	var he = $(".notice_active>ul>li").height();//找到li高
	$(".notice_active>ul").animate({
			"marginTop": "-" + he
		}, 500, function () {
			$(".notice_active>ul").css({
				"marginTop": 0
			});
			//二选一
			//复制第一个到最后一个
			$(".notice_active>ul>li").eq(0).appendTo($(".notice_active>ul")); 					      	
			//复制第一个到最后一个(多个的情况)	
			$(".notice_active_two>ul>li:eq(0),.notice_active_two>ul>li:eq(1),.notice_active_two>ul>li:eq(2)").appendTo($(".notice_active_two>ul")); 		
	});
}

//4. 触发方法
//新闻动态
var time = setInterval(function () {
	t();
}, 5000) 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值