Scroll Into View Detector
Overview
Triggers either an event or sets a boolean when the widget's DIV is scrolled into view. This can be used to detect when a user has scrolled to the end of a terms and conditions form.
Documentation
Description
Triggers an event or sets a boolean when the widget's DIV is scrolled into view. This can be used to detect when a user has scrolled to the end of the terms and conditions form. View source code on Github.
Typical usage scenario
If you have a very long text, like terms and conditions, and you need a way of knowing when the user has reached the end of the form before allowing them to continue with a Wizard.
Could be used to prevent data on a page from loading until it has been scrolled into view. Do this by having the data view’s visibility disabled by a boolean and having the widget set the boolean blocking the date view to true when scrolled into view.
Features and limitations
Features:
- Trigger a Mendix event when the widget is scrolled into view
- Sets a Mendix boolean to true when the widget is scrolled into view
Limitations:
- None known
Dependencies
- None
Installation
- Put the widget in your project’s Widget folder and go to App → Synchronize App Directory.
- Place the widget on your page below the text you want to detect the end and inside the same container as that text (i.e.
- If you want to set a boolean, change “Set a Boolean?” to Yes and select the “Boolean to Change”.
- Note: This requires the widget to be inside a data view and the boolean selection will be an attribute on the object the data view returns.
- If you want to call a Mendix action, set “Scrolled Into View Action”. Make sure “Set a Boolean?” is set to No.
- After you’ve completed your testing, be sure the set “Debug Move?” to No.
Configuration
- Debug Mode
- a blue and red message will display where the widget is rendered
- the browser console will receive logs when actions are performed
- use this to see the exact point the widget is activated
- Set a Boolean?
- If true, the widget will update the boolean attribute defined in “Boolean to Change”
- If false, the widget will execute the action defined in “Scrolled Into View Action”
- Note: The current user needs read/ write permission for setting the boolean or permission to execute the action
- Boolean to Change
- The attribute the widget will update when the widget is scrolled into view
- This attribute is only changed if “Set a Boolean?” is true
- Scrolled Into View Action
- The page, microflow, nanoflow etc. that widget will trigger when the widget is scrolled into view
Bugs
None Yet – please submit any to https://github.com/bsgriggs/mendix-scroll-into-view-detector/issues