JavaScript Implementation Focus Scrolling Graph effect Concrete method _javascript Skill

Source: Internet
Author: User
Tags setinterval

Foreground code:

Copy Code code as follows:

<div class= "Sub_box" >
<div id= "P-select" class= "Sub_nav" >
<div class= "Sub_no" id= "BD1LFSJ" >
<ul>
<li class= "Show" >1</li>
<li class= "" >2</li>
<li class= "" >3</li>
<li class= "" >4</li>
<li class= "" >5</li>
<li class= "" >6</li>
<li class= "" >7</li>
</ul>
</div>
</div>
<div id= "Bd1lfimg" >
<div>
&LT;DL class= "Show" >
</dl>
<asp:repeater id= "reptoppicture" runat= "Server" >
<ItemTemplate>
&LT;DL class= "" >
<dt><a href= "" >
'/></a></dt>
</dl>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
<script type= "Text/javascript" > Movec ();</script>

JavaScript code:

Copy Code code as follows:

Selector
function $a (id,tag) {var re= (id&&typeof id!= "string")? Id:document.getElementById (ID); if (!tag) {return re;} Else{return re.getelementsbytagname (tag);}

Focus scrolling Map Click to move
function Movec ()
{
var o= $a ("bd1lfimg", "");
var oli= $a ("bd1lfimg", "DL");
var oliw=oli[0].offsetwidth; The width of each move
var ow=o.offsetwidth-2;
var dnow=0; Current position
var olf=oliw-(ow-oliw+10)/2;
o["ScrollLeft"]=olf+ (DNOW*OLIW);
var rqbd= $a ("BD1LFSJ", "ul") [0];
var extime;

<!--for (Var i=1;i<oli.length;i++) {rqbd.innerhtml+= "<li>" +i+ "</li>";} -->
var rq= $a ("BD1LFSJ", "Li");
for (Var i=0;i<rq.length;i++) {reg (i);};
Oli[dnow].classname=rq[dnow].classname= "Show";
var wwww=setinterval (uu,2000);

function Reg (i) {rq[i].onclick=function () {oli[dnow].classname=rq[dnow].classname= "";d now=i;oli[dnow].classname= Rq[dnow].classname= "Show"; MV ();}
function mv () {clearinterval (extime); clearinterval (WWWW); Extime=setinterval (bc,15); Wwww=setinterval (uu,8000);
function BC ()
{
var ns= ((Dnow*oliw+olf)-o["ScrollLeft");
var v=ns>0? Math.ceil (NS/10): Math.floor (NS/10);
o["ScrollLeft"]+=v;if (v==0) {clearinterval (extime); Oli[dnow].classname=rq[dnow].classname= "Show"; v=null;}
}
function UU ()
{
if (dnow<oli.length-2)
{
Oli[dnow].classname=rq[dnow].classname= "";
dnow++;
Oli[dnow].classname=rq[dnow].classname= "Show";
}
Else{oli[dnow].classname=rq[dnow].classname= "";d now=0;oli[dnow].classname=rq[dnow].classname= "show";}
MV ();
}
O.onmouseover=function () {clearinterval (wwww);}
O.onmouseout=function () {extime=setinterval (bc,15); Wwww=setinterval (uu,8000);}
}

Related Article

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.