GreenInfo-Network / seattle-building-dashboard

Energy benchmarking for Seattle
https://greeninfo-network.github.io/seattle-building-dashboard/
ISC License
1 stars 0 forks source link

make anchor link work with scrollTo #18

Closed tomay closed 2 years ago

tomay commented 2 years ago

To make the anchor link work, seems like there's an existing approach we can crib from the old deprecated "See Ways to Save" button:

image

At the top of building_scorecard.js there is this:

    events: {
      'click .sc-toggle--input': 'toggleView',
      'click .ways-to-save-button': 'scrollToLinks'
    },

and then

    scrollToLinks: function(evt) {
      evt.preventDefault();
      this.parentEl[0].scrollTo(0, this.parentEl.find('#links')[0].offsetTop);
      return false;
    },

So we just need to style this as a link, but not use an <a> tag, and then follow the above pattern to make it scroll to the desired section

┆Issue is synchronized with this Asana task