Picture of Matt Leathes
Re: Best way to add global functionality?
by Matt Leathes - Monday, 8 August 2016, 9:14 AM
 

Yes, you should consider adding a plugin. This type of functionality would be best done as an extension (since it's not a component, menu or theme).

You should have a look at keepScrollPosition. Even though the specific functionality is quite different to what you want, at a high-level it is much the same i.e. create an extension do something on menu/page load.

Note that you would still be using JQuery to do what you want, you'd just be packaging the functionality as an Adapt plugin. Also note that JQuery is already included in Adapt so you don't need to worry about loading it.