The slider changes the image size.

Source: Internet
Author: User
Analysis: first introduce an image, display a slider on the page, and determine the image size. When the slider is triggered to slide, you need to get the slider value, and then set the width and height of the image to the slider value implementation code: first introduce the corresponding jqueryui class library file <SCRIPT type = "text/JavaScript" src = "$ {pagecontext. request. contextpath}/JavaScript/jquery-1.7.1.min.js "> </SCRIPT> <SCRIPT type =" text/JavaScript "src =" $ {pagecontext. request. contextpath}/JS/jquery-ui-1.8.18.custom.min.js ">></SCRIPT> <link type =" text/CSS "rel =" stylesheet "href =" $ {pagecontext. request. contextpath}/CSS/UI-lightness/jquery-ui-1.8.18.custom.css "/> insert an image in the body, write an empty Div to store the slider <Div id = "Demo"> <Div id = "image">  </div> <br/> <Div id =" slider "> </div> show the slider when writing code in the head <SCRIPT type =" text/JavaScript "> $ (function () {$ ("# Slider "). slider ({}) ;}); </SCRIPT> can be found at $ ("# Slider "). in slider ({});, add parameters to set the default value and step of the slider, for example, value: 100, Min: 0, Max: 500, step: 50 triggered when the slider moves, get the value after the slider moves, and assign the value after the slider moves to the image change: function (event, UI) {var val = UI. value; // alert (VAL); $ ("# image IMG "). animate ({width: Val, height: Val });}

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.