ArticleDirectory
Jquery navigation directory for image scrolling and enlarging
Usage: 1. Introduce the jquery class library and related CSS
<Link href = "CSS/lanrenzhijia.css" type = "text/CSS" rel = "stylesheet"/> <SCRIPT type = "text/JavaScript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </ SCRIPT>
2. Definition content
<Div class = "sliderbox"> <Div id = "BTN-left" class = "arrow-BTN dasabled"> </div> <Div class = "Slider"> <ul> <li> <a href = "http://www.jqdemo.com/" target = "_ blank"> </a> </LI> <li> <a href = "http://www.jqdemo.com/" target = "_ blank"> </a> </LI> </ul> </div> <Div id = "BTN-Right" class = "arrow-BTN"> </div>
3. Use the jquery method:
VaR $ slider = $ ('. slider ul '); var $ slider_child_l = $ ('. slider ul li '). length; var $ slider_width = $ ('. slider ul li '). width (); $ slider. width ($ slider_child_l * $ slider_width); var slider_count = 0; if ($ slider_child_l <6) Then ('{btn-right'}.css ({cursor: 'auto '}); $ ('# BTN-right '). removeclass ("dasabled");} $ ('# BTN-right '). click (function () {if ($ slider_child_l <6 | slider_count >=$ slider_child_l-6) {return false;} slider_count ++; $ slider. animate ({left: '-=' + $ slider_width + 'px '}, 'low'); slider_pic () ;}); $ (' # BTN-left '). click (function () {If (slider_count <= 0) {return false;} slider_count --; $ slider. animate ({left: '+ =' + $ slider_width + 'px '}, 'low'); slider_pic () ;}); function slider_pic () {If (slider_count >=$ slider_child_l-6) then emerge ('your btn-right'}.css ({cursor: 'auto'}); $ ('# BTN-right '). addclass ("dasabled");} else if (slider_count> 0 & slider_count <= $ slider_child_l-6) Then ('your btn-left'}.css ({cursor: 'pointer '}); $ ('# BTN-left '). removeclass ("dasabled" has been installed ('{btn-right'}.css ({cursor: 'pointer '}); $ (' # BTN-right '). removeclass ("dasabled");} else if (slider_count <= 0) Then ← ('your btn-left'}.css ({cursor: 'auto'}); $ ('# BTN-left '). addclass ("dasabled") ;}}$ ('. slider '). hover (function () {if ($ (this ). find ('img: animated '). length) return; $ (this ). animate ({margintop: '0px '}, 300); $ (this ). find ('img '). animate ({width: '150px '}, 300) ;}, function () {$ (this ). animate ({margintop: '24px '}, 200); $ (this ). find ('img '). animate ({width: '90px '}, 200 );});
original text transferred from: jquery navigation achieves image scrolling and enlarging