Using jquery to implement scrolling news _jquery

Source: Internet
Author: User
This article mainly uses jquery to achieve scrolling news, so few code can realize this function is really can't help exclaiming jquery's powerful function.
Copy Code code as follows:

<%@ Page language= "C #" autoeventwireup= "true" codebehind= "Default.aspx.cs" inherits= "Webapplication244.default"% >

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<title></title>
<script src= "Scripts/jquery-1.4.1.min.js" type= "Text/javascript" ></script>
<script language= "javascript" type= "Text/javascript" >
$ (function () {
var scrolltimer = null;
var delay = 2000;
1. Mouse on the news triggered mouseout event every 2s call scrollnews ()
2. Stop calling Scrollnews () after the MouseOver event is triggered by the mouse on the news
3. The first load page triggers the mouse to the news mouseout event
$ (' div.scrollnews '). Hover (function () {
Clearinterval (Scrolltimer);
}, function () {
Scrolltimer = setinterval (function () {
Scrollnews ();
}, delay);
}). Triggerhandler (' mouseout ');
});
Rolling news
function Scrollnews () {
var $news = $ (' Div.scrollnews>ul ');
var $lineHeight = $news. Find (' Li:first '). Height ();
$news. Animate ({' margintop ':-$lineHeight + ' px '}, +, function () {
$news. css ({margin:0}). Find (' Li:first '). Appendto ($news);
});
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<div class= "Scrollnews" >
<ul>
<li><a href= "#" class= "tooltip" title= "1 sweet baggy sweater must be red this autumn." >1 Sweet loose sweater must be red in the autumn .</a></li>
<li><a href= "#" class= "tooltip" title= "2 autumn outfit hundred small vest less than 50 yuan." >2 autumn outfit hundred small vest less than 50 yuan .</a></li>
<li><a href= "#" class= "tooltip" title= "3 self-cultivation Korean version of the small suit million people crazy Rob." >3 self-cultivation Korean version of the small suit million people crazy Rob .</a></li>
<li><a href= "#" class= "tooltip" title= "4 late summer chiffon shopkeeper tearful big sale." >4 late summer chiffon shopkeeper tearful big sale .</a></li>
<li><a href= "#" class= "tooltip" title= "5 Ruili are wildly recommended autumn outfit." >5 Ruili are wildly recommended autumn outfit .</a></li>
<li><a href= "#" class= "tooltip" title= "6 yuan large knitted small shirts sell crazy." >6 yuan knitted small shirts selling crazy .</a></li>
<li><a href= "#" class= "tooltip" title= "7 long sleeve chiffon shirts are all super beautiful in a single dress." >7 long sleeve chiffon sweater single wear inside the lap is super beautiful .</a></li>
</ul>
</div>
</form>
</body>

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.