When a page is really long (for example, because of infinite scrolling), it becomes too tedious to scroll back up through screens and screens of content. Hence the role of the Back to Top button. It is not just very trendy, but also very useful and it is not implemented in Moodle by default (at least not yet, Moodle v3.8.2). You can see/use a similar one on this particular page, it is a yellow circle with a white arrow on the right.
Let's see how we can resolve that issue. Update: it is a core functionality from v3.9, but not as pretty as my solution ;)
In my version we are going to place the button hidden at the very end of every page (HTML) and reveal it when we scroll down a little bit (JQuery) and we will control the look as well (CSS).
Step 1: place the hidden button HTML code. Visit your
HTML
You can replace the name of the class of course or even you can use an ID instead of a class, it is up to you. BUT if you change the class to an ID, you have to modify the CSS and the JQuery codes as well.
Step 2: give it a style. Go to your theme CSS settings and insert the following code
CSS
Step 3: make it work. Go to your additional HTML settings and add the following JQuery code. Don't forget that you might have other codes already there.
JQuery
Tada! I hope it works for you. Visit my dummy Moodle site to see how it works for me. Don't forget to log in as a guest. Enjoy!
0 Comments
Leave a Reply. |