Controllable jquery image left and right scrolling plug-in code

Source: Internet
Author: User

This article provides you with a controllable jquery image left and right rolling plug-in code. We just used the jquery image left and right rolling plug-in to demonstrate the controllable and beautiful effects.

This article provides you with a controllable jquery image left and right rolling plug-in code. We just used the jquery image left and right rolling plug-in to demonstrate the controllable and beautiful effects.

<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> controllable jquery image left and right rolling plug-in code http://www.bKjia. c0m </title>
<Meta http-equiv = "content-type" content = "text/html; charset = gbk"/>
<Link href = "styles/common.css tutorial" rel = "stylesheet" type = "text/css"/>
<Script type = "text/Webpage effects" src = "scripts/jquery-1.4.2.min.js"> </script>
<Script type = "text/javascript">

Function focusbox (o ){
If (! O) return;
Var w = 630, $ o = $ ('#' + o), I = 0, l = 0; arr = [], t = null,
$ Infoli = $ o. find ('. banner_info li'), len = $ infoli. length * 2,
$ Ul = $ o. find ('. banner_pic> U ');
$Ul.append($ul.html()).css ({'width': len * w, 'left':-len * w/2 });
$ Infoli. eq (0). addclass ('current ');
// Add banner_pages element
Arr. push ('<div class = "banner_pages"> <ul> ');
$ Infoli. each (function (I ){
If (I = 0 ){
Arr. push ('<li class = "current"> <span>' + (I + 1) + '</span> </li> ');
} Else {
Arr. push ('<li> <span>' + (I + 1) + '</span> </li> ');
}
});
Arr. push ('</ul> </div> ');
$ O. append (arr. join (''));
Var $ pagesli = $ o. find ('. banner_pages li ');
// Mouse
$ Pagesli. children ('span '). click (function (){
Var p = $ pagesli. index ($ o. find ('. banner_pages li. current '));
I = $ pagesli. children ('span '). index ($ (this ));
If (I = p) return;
L = parseint($ul.css ('left') + w * (p-I );
Addcurrent (I, l );
Return false;
})
$ O. children ('A. btn_prev '). click (function (){
I = $ pagesli. index ($ o. find ('. banner_pages li. current '));
(I = 0 )? I = (len/2-1): I --;
L = parseint($ul.css ('left') + w;
Addcurrent (I, l );
Return false;
})
$ O. children ('A. btn_next '). click (function (){
I = ($ pagesli. index ($ o. find ('. banner_pages li. current') + 1) % (len/2 );
L = parseint($ul.css ('left')-w;
Addcurrent (I, l );
Return false;
})
// Auto focus
T = setinteger (init, 8000 );
$ O. hover (function (){
Clearinterval (t );
}, Function (){
T = setinteger (init, 8000 );
});
Function init (){
$ O. children ('A. btn_next '). trigger ('click ');
}
// Add focus
Function addcurrent (I, l ){
If ($ ul. is (': animated') return;
$ Ul. animate ({'left': l}, 500, function (){
$ O. children ('. banner_count'). text (I + 1 );
$ Infoli. not ($ infoli. eq (I). addclass ('stream'). removeclass ('stream ');
$ Pagesli. not ($ pagesli. eq (I). addclass ('stream'). removeclass ('stream ');
If (l = (1-len) * w ){
$Ul.css ({'left': (1-len/2) * w });
} Else if (l = 0 ){
$Ul.css ({'left':-len * w/2 });
}
});
}
}

$ (Function (){
Focusbox ('akafocal s ');
})
</Script>
</Head>

<Body>

<Div class = "banner" id = "kakafocus">
<A class = "btn_prev" title = "previous" href = "#"> previous </a>
<A class = "btn_next" title = "next" href = "#"> next </a>
<Div class = "banner_pic">
<Ul>
<Li> <a href = "#"> </a> </li>
<Li> <a href = "#"> </a> </li>
<Li> <a href = "#"> </a> </li>
<Li> <a href = "#"> </a> </li>
<Li> <a href = "#"> </a> </li>
</Ul>
</Div>
<Div class = "banner_info">
<Ul>
<Li>
<H4> <a href = "#"> jquery image scroll plug-in </a> <Div class = "ext">
Time: 2010-02-10 <span class = "pipe" >|</span>
Category: <a href = "#"> meitu </a> <span class = "pipe" >|</span>
Tags: <a href = "#"> Lego </a>, <a href = "#"> Lego </a>
</Div>
</Li>
<Li>
<H4> <a href = "#"> jquery image scroll plug-in --? </A> <Div class = "ext">
Time: 2010-03-16 <span class = "pipe" >|</span>
Category: <a href = "#"> high fever </a> <span class = "pipe" >|</span>
Tags: <a href = "#"> lego </a>, <a href = "#"> Lele </a>
</Div>
</Li>
<Li>
<H4> <a href = "#"> When should I start learning music? </A> <Div class = "ext">
Time: 2010-03-26 <span class = "pipe" >|</span>
Category: <a href = "#"> Products </a>, <a href = "#"> default </a> <span class = "pipe" >|</span>
Tags: <a href = "#"> spring festival </a>, <a href = "#"> le </a>, <a href = "#"> sum </a>
</Div>
</Li>
<Li>
<H4> <a href = "#"> about the preliminary national small reporter's election notice. </A> <Div class = "ext">
Time: 2010-03-26 <span class = "pipe" >|</span>
Category: <a href = "#"> Products </a>, <a href = "#"> left and right </a> <span class = "pipe" >|</span>
Tags: <a href = "#"> spring festival </a>, <a href = "#"> le </a>, <a href = "#"> sum </a>
</Div>
</Li>
<Li>
<H4> <a href = "#"> Chinese journalist news and Writing Competition? </A> <Div class = "ext">
Time: 2010-04-26 <span class = "pipe" >|</span>
Category: <a href = "#"> age </a>, <a href = "#"> spring festival </a> <span class = "pipe" >|</span>
Tags: <a href = "#"> brother </a>, <a href = "#"> wine </a>, <a href = "#"> last </a>
</Div>
</Li>
</Ul>
</Div>
<Div class = "banner_count"> 1 </div>
</Div> <! -- Banner end -->


<Div style = "height: 20px; background: # eee;"> </div>
</Body>
</Html>

Instance
Http://down.bKjia. c0m/down/code/jquery/2010/0830/20528.html
Effect preview address
Scroll down the image and control it with an arrow "> http://g.111cn.cn/javascript/js/20100830/jquery%20left/Right. Scroll down the picture and control it with an arrow

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.