Get Scroll Percentage Action
The Get Scroll Percentage Action stores the current scroll position of the page or a specified portion of the page in a JavaScript variable. The value is stored as the percentage of the scroll range, rather than as the number of pixels.
Options
- Variable Name: the name of the JavaScript variable to store the scroll percentage in.
- Top of Range: Specifies the point at which the scroll percentage is considered "0%". By default, this is the top of the page. However, you can specify something more complex -- for example, that you want the output value to be 0 when the bottom edge of a particular image is scrolled to 50 pixels below the top of the browser window.
- Bottom of Range: like Top of Range, but specifying the "100% scrolled" point (by default, the bottom of the page).
- Maximum Times: the maximum number of times that this Action will execute before it ignores all future events. The counter resets when the page is reloaded. If set to a negative value, it will execute an unlimited number of times.
An example of when you might use the Top of Range and Bottom of Range options would be for parallax scrolling. Instead of keying off of the top and bottom of the page, you might key off of the element that the image is displayed inside instead. The Top of Range would be where the top of the image is just coming into view at the bottom of the page. And the Bottom of Range would be where the bottom of the image is just scrolling out of view at the top of the page.