docs updated with information about the slider keys

This commit is contained in:
John Bender 2010-12-22 23:53:44 -08:00
parent 39f4749257
commit fa760da3bd
4 changed files with 23 additions and 18 deletions

View file

@ -1,14 +1,14 @@
<!DOCTYPE html>
<html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jQuery Mobile Docs - Forms</title>
<link rel="stylesheet" href="../../themes/default" />
<meta charset="utf-8" />
<title>jQuery Mobile Docs - Forms</title>
<link rel="stylesheet" href="../../themes/default" />
<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
<script type="text/javascript" src="../../js/"></script>
<script type="text/javascript" src="../docs/docs.js"></script>
</head>
<body>
</head>
<body>
<div data-role="page">
@ -17,20 +17,20 @@
</div><!-- /header -->
<div data-role="content">
<form action="#" method="get">
<h2>Sliders</h2>
<p>To add a slider widget to your page, start with an <code>input</code> with a new HTML5 <code>type="range"</code> attribute. Specify the <code>value</code> (current value), <code>min</code> and <code>max</code> attribute values to configure the slider. The framework will parse these attributes to configure the slider. </p>
<p>As you drag the slider, the input will update and vice-versa so they are always in sync so you can submit the slider value with form in a simple way. Set the <code>for</code> attribute of the <code>label</code> to match the ID of the <code>input</code> so they are semantically associated and wrap them in a <code>div</code> with the <code>data-role="fieldcontain"</code> attribute to group them.</p>
<pre><code>
<pre><code>
&lt;div data-role=&quot;fieldcontain&quot;&gt;
&lt;label for=&quot;slider&quot;&gt;Input slider:&lt;/label&gt;
&lt;input type=&quot;range&quot; name=&quot;slider&quot; id=&quot;slider&quot; value=&quot;0&quot; min=&quot;0&quot; max=&quot;100&quot; /&gt;
&lt;/div&gt;
</code></pre>
</code></pre>
<p>An example of a slider and input is displayed like this:</p>
<div data-role="fieldcontain">
<label for="slider-1">Input slider:</label>
@ -38,15 +38,18 @@
</div>
<p>By setting the <code>min</code> and <code>max</code>attributes you can configure the allowable number range of the slider track. The <code>value</code> of the input is used to configure the starting position of the handle and the value populated in the text input.</p>
<p>The slider with a min of 500, max of 5,000 and initial value of 2,500</p>
<div data-role="fieldcontain">
<label for="slider-2">Input slider:</label>
<input type="range" name="slider-2" id="slider-2" value="2500" min="500" max="5000" />
</div>
<p>Sliders also respond to the keyboards shortcuts. To increase the current value the Right Arrow, Up Arrow, and Page Up keys can be used. To decrease the current value the Left Arrow, Down Arrow, and Page Down keys can be used. To move the slider to its minimum or maximum value use the Home and End keys respectively.</p>
</form>
</div><!-- /content -->
</div><!-- /page -->

View file

@ -56,8 +56,9 @@
left: -10000px;
}
/* maintain styling */
.ui-mobile-viewport {
padding: 10px;
margin: 8px;
}
</style>

View file

@ -55,8 +55,9 @@
left: -10000px;
}
/* maintain styling */
.ui-mobile-viewport {
padding: 10px;
margin: 8px;
}
</style>

View file

@ -36,7 +36,7 @@
});
});
test( "slider should move to range minimum on end key press", function(){
test( "slider should move to range minimum on end keypress", function(){
var selector = "#range-slider-end",
initialVal = window.parseFloat($(selector).val(), 10),
max = window.parseFloat($(selector).attr('max'), 10);
@ -48,7 +48,7 @@
});
});
test( "slider should move to range minimum on end key press", function(){
test( "slider should move to range minimum on end keypress", function(){
var selector = "#range-slider-home",
initialVal = window.parseFloat($(selector).val(), 10);