From dcdca897171821431a4399347d2e2ecf5c8a40cc Mon Sep 17 00:00:00 2001 From: Casey Justus Date: Sun, 31 Jul 2011 17:47:03 -0400 Subject: [PATCH] added slider api --- docs/forms/sliders/events.html | 102 +++++++++++++++++++++++++++++ docs/forms/sliders/index.html | 112 ++++++++++++++++++++++++++++++++ docs/forms/sliders/methods.html | 108 ++++++++++++++++++++++++++++++ docs/forms/sliders/options.html | 101 ++++++++++++++++++++++++++++ 4 files changed, 423 insertions(+) create mode 100644 docs/forms/sliders/events.html create mode 100644 docs/forms/sliders/index.html create mode 100644 docs/forms/sliders/methods.html create mode 100644 docs/forms/sliders/options.html diff --git a/docs/forms/sliders/events.html b/docs/forms/sliders/events.html new file mode 100644 index 00000000..385afe00 --- /dev/null +++ b/docs/forms/sliders/events.html @@ -0,0 +1,102 @@ + + + + + + jQuery Mobile Docs - Select events + + + + + + + + + +
+ +
+

Select Menus

+ Home +
+ +
+
+ +
+ +

Sliders

+ + + +

Since the native input field is used as a proxy for the custom slider, you can watch for events on the original, native input field instead of needing to go through the slider plugin. Bind to the change event by type: change, blur, focus, keypress, click, etc.

+
 
+$( ".selector" ).bind( "change", function(event, ui) {
+  ...
+});
+
+ +

The slider plugin has the following custom event:

+ +
+ +
create triggered when a slider is created
+
+

This event is used to find out when a custom slider was created. It is not used to create a custom slider. The slider create event can be used like this:

+ +

+$( ".selector" ).slider({
+   create: function(event, ui) { ... }
+});		
+			
+
+ + +
+ +
+
+ + + +
+ + + +
+ + + + diff --git a/docs/forms/sliders/index.html b/docs/forms/sliders/index.html new file mode 100644 index 00000000..dc3b0f1b --- /dev/null +++ b/docs/forms/sliders/index.html @@ -0,0 +1,112 @@ + + + + + + jQuery Mobile Docs - Select + + + + + + + + + +
+ +
+

Select Menus

+ Home +
+ +
+
+ +
+

Sliders

+ + + +

To add a slider widget to your page, start with an input with a new HTML5 type="range" attribute. Specify the value (current value), min and max attribute values to configure the slider. The framework will parse these attributes to configure the slider.

+

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 for attribute of the label to match the ID of the input so they are semantically associated and wrap them in a div with the data-role="fieldcontain" attribute to group them.

+ +

+			<div data-role="fieldcontain">
+				<label for="slider">Input slider:</label>
+			 	<input type="range" name="slider" id="slider" value="0" min="0" max="100"  />
+			</div>
+			
+ +

An example of a slider and input is displayed like this:

+
+ + +
+ +

By setting the min and maxattributes you can configure the allowable number range of the slider track. The value of the input is used to configure the starting position of the handle and the value populated in the text input.

+ +

The slider with a min of 500, max of 5,000 and initial value of 2,500

+
+ + +
+ +

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.

+ + +

Refreshing a slider

+ +

If you manipulate a slider via JavaScript, you must call the refresh method on it to update the visual styling. Here is an example:

+ + + $("input[type=range]").val(60).slider("refresh"); + + + +
+
+ + + +
+ + + +
+ + + + diff --git a/docs/forms/sliders/methods.html b/docs/forms/sliders/methods.html new file mode 100644 index 00000000..03315845 --- /dev/null +++ b/docs/forms/sliders/methods.html @@ -0,0 +1,108 @@ + + + + + + jQuery Mobile Docs - Select methods + + + + + + + + + +
+ +
+

Sliders

+ Home +
+ +
+
+ +
+ +

Sliders

+ + + +

The slider plugin has the following methods:

+ +
+
enable enable a disabled select
+
+

+$('select').slider('enable');			
+				
+
+ +
disable disable a select.
+
+

+$('select').slider('disable');			
+				
+
+ +
refresh update the slider
+
+ This is used to update the slider to reflect the native input element's value. Also, if you pass a true argument you can force the rebuild to happen. +

+//refresh value			
+$('select').slider('refresh');
+
+//refresh and force rebuild
+$('select').slider('refresh', true);
+				
+
+ +
+ +
+
+ + + +
+ + + +
+ + + + diff --git a/docs/forms/sliders/options.html b/docs/forms/sliders/options.html new file mode 100644 index 00000000..8b8a673b --- /dev/null +++ b/docs/forms/sliders/options.html @@ -0,0 +1,101 @@ + + + + + + jQuery Mobile Docs - Select options + + + + + + + + + +
+ +
+

Sliders

+ Home +
+ +
+
+ +
+ +

Sliders

+ + + +

The slider plugin has the following options:

+ +
+ + +
initSelector CSS selector string
+
+

default: "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')"

+

This is used to define the selectors (element types, data roles, etc.) that should be used as the trigger to automatic initialization of the widget plugin. To affect all selects, this option can be set by binding to the mobileinit event:

+
$( document ).bind( "mobileinit", function(){
+	$.mobile.slider.prototype.options.initSelector = ".myslider";
+});
+
+
+ +
theme string
+
+

default: null, inherited from parent

+

Sets the theme swatch color scheme for the select element. This is a single letter from a-z that maps to the swatches included in your theme. By default, a select will inherit the same swatch color as it's parent container if not explicitly set. This option is also exposed as a data attribute: data-theme="a"

+
$('input').slider({ theme: "a" });
+
+ +
+ +
+
+ + + +
+ + + +
+ + + +