js achieve real-time updates change announcement

<div class = "notice_active"> 
<ul>
<li> <a href=""> Can Technology Swiss direct recruit talent network nbsp &; & nbsp; [2019-01-24] </a> </ li>
<li> <a href=""> Swiss Can Technology is welcome to return to work in those candidates nbsp &; & nbsp; [2020-02-24] </a> </ li>
<li> <a href=""> Pingdingshan City has also recently one patient has been diagnosed nbsp &; & nbsp; [2020-04-02] </a> </ li>
</ ul>
</ div>


.notice_active,ul li{margin: 0;padding: 0}
.notice_active{
width:380px;
height: 35px;
padding: 0 30px;
background-color: #b3effe;
overflow: hidden;
}
.notice_active ul li{
list-style: none;
line-height: 35px;
/*以下是为了单行显示 ,超出隐藏*/
display: block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
// Bulletin real-time updates 
/ **
*
* @param obj: node This example animation is ul
* @param Top: in this case the height of the animation is -35px; note scroll up negative
* @param Time: is rolling the present embodiment is provided speed 3000 ms
* function: each animation callback function is completed, marginTop zero at this time and adds to the list of the first message back
* /
function noticeUp (obj, Top, Time) {
$ (obj) .animate ({
marginTop: Top
}, Time, function () {
$ ( the this) .css ({marginTop: "0"}) Find (. ": First") the appendTo (. the this)
})
}
var = MyMar the setInterval ( " noticeUp ( '. notice_active UL', '- 15px', 1000) ", 3000);
document.getElementsByClassName (" notice_active ") the onmouseover =.. function () {
the clearInterval (MyMar);
};
document.getElementsByClassName(".notice_active").onmouseout=function(){
MyMar=setInterval("noticeUp('.notice_active ul','-15px',1000)",3000)
};

Guess you like

Origin www.cnblogs.com/xiaokemo/p/12620994.html