SCUACM / ACM-Website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Footer Logo click should scroll to top on home page

rileywong311 opened this issue · comments

image

This is a good first issue. SCU ACM members are especially encouraged to try this out.!

Clicking this SCU ACM logo on the footer takes you back to the homepage (via the Vue.js router). However, when already on the homepage it does nothing. It would be a nice feature to scroll back up to the top of the page when this is clicked on the homepage.

Likely, this involves the <element>.ScrollTo / <element>.ScrollIntoView JavaScript function (and perhaps a Vue.js component method to run this). The element will have to be accessed somehow. I've found ways to do this through the CSS id styling, but there might be a way to do it with Vue.js refs.

For example, I've done something like this before:

async toHome() {
    await this.$router.push('/')
    const element = document.getElementById("Title");
    element.scrollIntoView({behavior: 'smooth'}); 
},