Posts

Showing posts from September, 2022

Jump to the top of a web page

Image
While I am surfing the web for research, fun or even work, I keep an eye out for cool looking UI elements. I recently found one that is so simple, yet so useful. I was on a site, like most sites these days, which had an exceedingly long home page. I am so accustomed to these long pages that I just scroll to the top without thinking about it. This web site had a non-assuming icon at the lower right in the footer. There was no label or tooltip to explain what it was for. They might want to change that part, but it is fun to find these hidden treats. When you clicked the icon, it jumped the page back up to the top of the page, nice and smooth. I thought it was cool. I kept going to the bottom and clicking on it.   How did they do it? When I looked at the code, I was surprised at how simple it was:       onclick=`window.scrollTo({top:0, behavior:`smooth`})` That was it! My next thought was, can I do this in Blazor?   Blazor Implementation Go...