Initializing
The demo pages already include the following code. These steps are only necessary if you are building a page from scratch. Remove these references if you are not using this plugin to improve page load times.
mrSticky relies on the ScrollMonitor plugin.
-
Include the library in your page
-
Copy the script tag below and paste in the foot of your page. Add this where you see the other library scripts. This line should be inserted after
jquery.jsand beforetheme.js.<!-- ScrollMonitor (manages events for elements scrolling in and out of view) --> <script type="text/javascript" src="assets/js/scrollMonitor.js"></script>Alternatively you may wish to load this resource from a CDN to potentially improve page load times.
<!-- ScrollMonitor (manages events for elements scrolling in and out of view) --> <script type="text/javascript" src="https://unpkg.com/scrollmonitor@~1.2.4"></script>
-
-
Load the initializer code in
index.js-
Declare the following import statement in
js/mrare/index.js. This ensures that the initializer code is included in thetheme.jsbundle.import mrSticky from './sticky'; -
Ensure the following line appears in the
exportobject:export { mrSticky, };
-