The Text Reader control can be used to expand text when the text is larger than a specified number of characters. The extra text is hidden until the user clicks a "Show More" or other specified link.
Like almost all SPARK controls, you can trigger events that are fired when the user interacts with the control (see the Event and Methods sections below and the Event Handling article for more information).
Appearance
Width The width of the text box in px, em, or %
Height The height of the text box in px, em, or %
Size Style The size style of the text, Default, Large, or Small
Label Placement The label placement, Top or Left
Behavior
Max Text Length Maximum of characters displayed before the 'Read More' hint is displayed. If not specified or >1, then 128 characters is assumed bu default.
Read More Hint Text displayed for the 'read more' hint
Read Less Hint Text displayed for the 'read less' hint
Initially Expanded When enabled, text reader will be expanded on load
Example
These are the configuration option settings...
When the page loads...
When 'Click here to read more...' is clicked...
When 'Click here to read less...' is clicked...
Note: The text that the Text Reader displays is held in a variable called str1, and is bound to the Text Reader. Alternatively, you can use the setText method to populate the Text Reader text.
Events
With the Text Reader control, there are 4 types of event handlers:
- On Load When the page loads
- On Click When the Text Reader is clicked
- On Expand When the Text Reader is expaned
- On Collapse When the Text Reader is collapsed
You can use JavaScript logic to affect the effects of the control, depending on the event. More information on using these controls can be found in the Event Handling article.
Methods
For detailed information on the available methods for this control, access the JS Doc file.
- Authors: Courtney Silva
- Date Created: March 28, 2016
- Date Modified: March 28, 2016
Comments