Hi there,
i rarely use sliders but if i were to try this i would generally opt for a plugin to do this. But seeing as that article provides the code you could do this with the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
You would create two hook elements, the first to contain the HTML.
This article shows where the hooks are displayed:
https://docs.generatepress.com/article/hooks-visual-guide/
The second hook would contain the javascript. And you would add this to the wp_footer
hook.
Make sure both Hooks have the same display rules.
Then read here for adding CSS:
https://docs.generatepress.com/article/adding-css/