Control width with slider

Description

The following code shows how to control width with slider.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.6.4.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css">
<script type='text/javascript'
  src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){<!-- ww w .  jav  a2  s . c o  m-->
    $("#slider").change(function() {
        sliderValue = $(this).val();
        $("#proportion").width(sliderValue*3);
        $("#proportion").height(300-sliderValue*3);
    });
});//]]>  
</script>
</head>
<body>
  <div data-role="fieldcontain">
    <input type="range" name="slider" id="slider" value="60" min="0"
      max="100" />
  </div>
  <div id="proportion"
    style="border: 1px solid #ccc; width: 150px; height: 150px;" /></div>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme