sliderticks
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sliderticks [2022/09/29 10:58] – admin | sliderticks [2023/03/09 17:26] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== sliderTicks - Add top and/or bottom tick marks for slider grid lines ====== | + | ====== sliderTicks - add top and/or bottom tick marks for slider grid lines ====== |
| - | The sliderTicks function adds top and/or bottom tick marks for each slider gridline. | + | The **sliderTicks** function adds top and/or bottom tick marks for each slider gridline. |
| Functionality includes: | Functionality includes: | ||
| Line 7: | Line 7: | ||
| * Add top, bottom, or top and bottom tick marks. | * Add top, bottom, or top and bottom tick marks. | ||
| - | sliderTicks ONLY works with mobile friendly sliders. | + | **sliderTicks** ONLY works with mobile friendly sliders. |
| - | Here is a quick video demonstration: | + | Here is a quick video demonstration |
| {{ :: | {{ :: | ||
| Line 15: | Line 15: | ||
| ===== Set-up Instructions ===== | ===== Set-up Instructions ===== | ||
| ==== Survey Header ==== | ==== Survey Header ==== | ||
| - | To make the function available to all questions in the survey, copy the function to the Survey Header inside a script tag: | ||
| Add the sliderTicks function to the survey header to make it available to any question in the survey. | Add the sliderTicks function to the survey header to make it available to any question in the survey. | ||
| < | < | ||
| Line 21: | Line 20: | ||
| </ | </ | ||
| Alternatively, | Alternatively, | ||
| + | ==== Custom CSS ==== | ||
| + | The provided **[[sliderTicks# | ||
| ==== Slider Question ==== | ==== Slider Question ==== | ||
| === Question Settings === | === Question Settings === | ||
| Line 26: | Line 27: | ||
| * Set desired number of gridlines | * Set desired number of gridlines | ||
| === Question JavaScript === | === Question JavaScript === | ||
| - | Add JS to call the sliderTicks function to apply it to the Slider question as follows: | + | Add JS to call the **sliderTicks** function to apply it to the Slider question as follows: |
| < | < | ||
| Qualtrics.SurveyEngine.addOnload(function() { | Qualtrics.SurveyEngine.addOnload(function() { | ||
| Line 41: | Line 42: | ||
| ===== Options ===== | ===== Options ===== | ||
| ==== bottomMarginTop ==== | ==== bottomMarginTop ==== | ||
| - | **bottomMarginTop** is an integer, usually negative, that specifies the top margin of the bottom ticks in pixels. This determines the space between slider bar and the bottom ticks. The ideal margin will vary based on theme and layout. Instead of this option, use **[[sliderticks# | + | **bottomMarginTop** is an integer, usually negative, that specifies the top margin of the bottom ticks in pixels. This determines the space between slider bar and the bottom ticks. The ideal margin will vary based on theme and layout. |
| - | Default: undefined (use CSS instead) | + | Use this option only to override the provided **[[sliderticks# |
| + | |||
| + | Default: undefined (use CSS rules) | ||
| ==== bottomTicks ==== | ==== bottomTicks ==== | ||
| - | **bottomTicks** is a boolean that specifies if bottom ticks should be displayed. To hide bottom | + | **bottomTicks** is a boolean that specifies if bottom ticks should be displayed. To hide bottom |
| Default: true | Default: true | ||
| + | ==== tickChar ==== | ||
| + | **tickChar** is the character used for tick marks. | ||
| + | |||
| + | Default: %%" | ||
| ==== tickPadding ==== | ==== tickPadding ==== | ||
| - | **tickPadding** is an object of arrays that allows for tick marks to be adjusted to align with the center of the slider handle at each gridline. Default arrays are provided for the most popular scales: 3, 4, 5, 7, 10, and 11 points (note: the number of gridlines specified in a Qualtrics slider question is always one less than the number of scale points). If no array is specified for the number of scale points, tick marks are aligned the same as the number scale. The adjustments specified in **tickPadding** are the differences in positioning from the number scale. Each **tickPadding** array consists of an object specifying the side of the adjustment (left or right) and the size of the adjustment in pixels. For example, a function call specifying **tickPadding** for a 3-point scale would look like this: | + | **tickPadding** is an object of arrays that allows for tick marks to be adjusted to align with the center of the slider handle at each gridline. The adjustments specified in **tickPadding** are the differences in positioning from the number scale. Each **tickPadding** array consists of an object specifying the side of the adjustment (left or right) and the size of the adjustment in pixels. For example, a function call specifying **tickPadding** for a 3-point scale would look like this: |
| < | < | ||
| addSliderTicks(this, | addSliderTicks(this, | ||
| Line 61: | Line 68: | ||
| }); | }); | ||
| </ | </ | ||
| + | Use this option only to override the provided **[[sliderticks# | ||
| + | |||
| + | Default: {} (use CSS rules) | ||
| ==== topMarginBottom ==== | ==== topMarginBottom ==== | ||
| - | **topMarginBottom** is an integer, usually negative, that specifies the bottom margin of the top ticks in pixels. This determines the space between the top ticks and slider bar. The ideal margin will vary based on theme and layout. Instead of this option, use CSS to set a consistent margin for the entire survey. | + | **topMarginBottom** is an integer, usually negative, that specifies the bottom margin of the top ticks in pixels. This determines the space between the top ticks and slider bar. The ideal margin will vary based on theme and layout. |
| - | Default: undefined (use CSS instead) | + | Use this option only to override the provided **[[sliderticks# |
| + | |||
| + | Default: undefined (use CSS rules) | ||
| ==== topTicks ==== | ==== topTicks ==== | ||
| - | **topTicks** is a boolean that specifies if top ticks should be displayed. To hide top ticks set to false. | + | **topTicks** is a boolean that specifies if top ticks should be displayed. To hide top tick marks set to false. |
| Default: true | Default: true | ||
| - | ===== CSS for Tick Margins | + | ===== CSS ===== |
| - | Here is example | + | The provided |
| - | < | + | - The top and bottom margins of the tick containers. The margins |
| - | .JFEScope .Skin .q-slider | + | |
| - | .JFEScope | + | |
| - | </ | + | The CSS rules can be overridden on a individual question basis by using the **[[sliderTicks# |
| ====== Qualtrics Wiki ====== | ====== Qualtrics Wiki ====== | ||
| [[start|Qualtrics Wiki]] | [[start|Qualtrics Wiki]] | ||
sliderticks.1664463539.txt.gz · Last modified: by admin
