jquery Header line information scrolling display

Source: Internet
Author: User

Jsp:

The following is the control scrolling style, the scrolling content query out, put in a div or other container, I use the <dt>

<style>
#newCglist {Width:300px;height:14px;line-height:14px;overflow:hidden}
#newCglist li{height:14px;padding-left:10px;}
</style>


The following is a container for scrolling content display

<dt class= "Positionrel" id= "newcglist" ><div class= "New Positionabs" ></div></dt>


The following is JS, query scrolling display content

var divhight; //This is the height of all data rows, the row height per row * Data volume
var showtimes; //Displays the time of all data, each line shows the time required * Data volume

Function Yejis () {
setinterval (' AutoScroll ("#newCglist") ', $);
//latest deal case show
$.post ("Zraction!newcglist.action", null,function (data) {
divhight = data.length*14;
showtimes = data.length*3000;
$.each (data,function (i,datas) {
$ul = $ ("<ul></ul>");
$TR = $ ("<li>" +datas[0]+ "signed successfully! &nbsp; " +datas[1]+ "Yuan &nbsp;" +datas[2]+ "&nbsp;" +datas[3]+ "</li>");
$ul. Append ($TR);
$ ("#newCglist"). Append ($ul);
});
});


Here are the controls for scrolling display time, as well as styling

/**
* Page top scrolling effect, divhight is the row height of all data
* Showtimes //time required to cycle through this data
* @param {Object} obj
* @memberOf {TypeName}
*/
function AutoScroll (obj) {
$ (obj). Find ("Ul:first"). Animate ({
Margintop:-divhight
},showtimes,function () {
$ (this). CSS ({margintop: "0px"}). Find ("Li:first"). AppendTo (this);
});
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.