Jquery navigation enables image scrolling and enlarging

Source: Internet
Author: User
ArticleDirectory
    • Usage:

 

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

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.