Hacker News new | past | comments | ask | show | jobs | submit login
Elevator.js (2015) (tholman.com)
273 points by susam on Feb 24, 2022 | hide | past | favorite | 82 comments



A very cute bit of coding.

But: I've always wondered who uses these "back to the top" buttons, and why?

Until quite recently I hardly ever had reason to go back to the top of the page—I was much more likely to click a link or click the back button—and if I did a quick tap of the home key or flick of the touchscreen usually did the trick. Conveniently, both gestures work even if you've not gotten all the way down to the "back to the top" button.

More recently with Chrome on iOS I find myself wanting to get to the top so I can use the pull-down-then-right gesture to close the tab. With really long pages sometimes a single flick isn't enough to get me all the way to the top—but then, on a really long page I'm also unlikely to have gotten all the way to the bottom.


On iOS, tap the top of the screen to automatically scroll to the top.


Oh THAT'S what that's supposed to be. I was always wondering why my viewport jumps all over the place unprompted.


And is frustratingly, conspicuously missing in Android. Every time I switch to my Android tablet, it's becomes a hugely missing piece for any content consumption app that scrolls.


I think I read here on HN that Apple holds a patent for that functionality.


This also works in most apps, unless they’re using some weird nonstandard UI (which is, perhaps surprisingly, less common on iOS than on macOS). And it works with Reachability. Neither of which are especially discoverable, but super handy if you know about them.


Except on AMP pages or on weird custom front ends. Long love plain html and css. Please don’t override the platform default scroll acceleration either!


There's usually some combination of the Home key that does the same on most desktop browsers, but the control key varies by OS and sometimes browser.

What there isn't on iOS as far as I'm aware is a way to scroll to the bottom. On infinite scroll pages accidentally navigating away as one can easily do with touch screen results in a lot of frustration.


How do you scroll to the bottom of an infinite page?


You scroll as far as the browser lets you. Then the page resizes, and you scroll again. If you know you were about 5 pages down, this is shedloads faster than scrolling by hand like a chump.


Yeah, I wish there were a way to scroll to the bottom too, i.e., double-tap the top of the screen/bar. It would come in handy quite frequently for me.


I think back in Ye Olde Days it was harder for people who just had a scrollbar, and weren't necessarily all that familiar with that, either.

There has never been a technical need for it. The "Home" keyboard button when pressed on a web page has taken you to the top probably since the very first web browser was released. But there's a lot of computer users for whom that entire complex of keys off to the right of Enter on a standard keyboard is The Outer Hinterlands, Where There Be Dragons, except for maybe the arrow keys. Also the entire line of function keys. Not everyone is an expert.


Reading your post I realized that I have not pressed a Home button for years. Now I have a strong Home button (and full sized keyboard in general) nostalgia and cannot sleep!

I will just go ahead and press it next time I see a full sized keyboard I swear!


Btw on most crop keyboards home is mapped to Fn + Left Arrow. No need to dig up that old IBM keyboard :-)


It's more useful for mobile, where there isn't a "home" key and you'll often need to scroll back up to access menus/filters/etc.


Yeah, in the days where fixed nav at top is often used by default it is not as common to have TOP links any more. Recently I searched for a way to PREVENT going to the top clicking a link <a href="#" onclick="console.log(1)"> that only had JavaScript in it and always jumped back and forth due to AJAX page reload.

The solution[1] I found was using <a href="#!" onclick="console.log(1)">A no jump link</a>.

[1]https://pilabor.com/blog/2021/03/html-and-css-tricks/#no-jum...


On a slight tangent, links should not be used as buttons - please use a HTML button and style it with css. Links-as-buttons tend to interact poorly with things like opening in new tabs, and it's not the semantically correct use of the element anyway.

> If clicking the link without javascript doesn't do anything without Javascript, it should be a `button`

https://css-tricks.com/a-complete-guide-to-links-and-buttons...


You can make the onclick event.preventDefault to prevent the scroll and adding hashtag to the URL


I think it was more of a thing in a bygone era when scroll wheels and swiping didn't have that inertia effect to get you to the top efficiently.

Nowadays you just swipe down fast once and the inertia gets you to the top but it used to once not be like that, and you had to thumb your screen 15 times to free solo your way to the top.


On a pull-to-refresh style widget, the scrollbar needs to be at the top. This provides a shortcut to jump to the top and refresh.


The Factorio blog [1] does a similarly fun thing with it's return to top functionality. It's a fun little easter egg.

Hint: rockets go up

[1] https://www.factorio.com/blog/post/fff-367


I regret that I could only do it once.


(2015) unless there's something new here

Lots of previous somewhat recent discussion:

2 years ago https://news.ycombinator.com/item?id=23623470

7 years ago https://news.ycombinator.com/item?id=9416993


That scared the shit out of me. Thanks.


I could almost perceive the scent of Chanel No. 5 and roasted-cashews while I was riding on the UP-elevator.


All the comments hating on the audio is hilarious, I have to admit the audio is definitely louder than normal. It seems to have been tampered with to increase its loudness. Combined with the fact that the browser wouldn't have played it if it wasn't for the click interaction for "back to the top", which is of course the whole point of this demo. If intentional, clever and definitely deserves a HN front-page recognition.


Many comments on the previous discussions:

June 2020 (313 comments): https://news.ycombinator.com/item?id=23623470

April 2015 (66 comments): https://news.ycombinator.com/item?id=9416993


Right you are. Macroexpanded:

Elevator.js – A “back to top” button that behaves like a real elevator - https://news.ycombinator.com/item?id=23623470 - June 2020 (313 comments)

ElevatorJS – Scroll to top the old-fashion way - https://news.ycombinator.com/item?id=17048610 - May 2018 (1 comment)

Finally, a “back to top” button that behaves like a real elevator - https://news.ycombinator.com/item?id=9446389 - April 2015 (10 comments)

Elevator.js - https://news.ycombinator.com/item?id=9416993 - April 2015 (66 comments)

(Reposts are ok after a year or so. This is in the FAQ: https://news.ycombinator.com/newsfaq.html.)


Most excellent, but the music needs to fade-in and the ride should end with a ding.


It does end with a ding


Loved the audio. I thought this was a serious library and was wondering why anyone would use it for something so simple until it started to play music.


I give it 3.5 / 5. It needs to preload the audio at least shortly before I click the button for optimal experience.


Also needs multiplayer support - if someone else presses the button soon after you have to wait and ride up together


No voice announcements? :/


We hit rock bottom in the web dev community just now.


Stanley Parable Ultra Deluxe JavaScript Port?!


Expected the music, was pleasantly surprised by the great comedic timing of the bell. Very nice.


There's a slight pause between when you click and the elevator starts rising.


Just like a real elevator!


This should really be mandatory for any mall or office block website


Going to slip this into prod real quick


This is so fun! Great work


This is awesome haha


Fantastic surprise!


Why? Can’t you just use anchor tags?


Isn't that the punchline of the joke? At least I took it as a joke poking fun at javascript libraries that re-implement basic features in a more obnoxious fashion.


I think it's kinda fun actually...


Because... humor?


It’s funny how sites used to play music all the time and now people are on the phone with the FBI to report any site with audio


I was the accidental instigator of an incident where Mosaic for Windows ended up with April Fool's jokes embedded in it.

It was probably the first time I noticed what others have noticed since then, which is that I have a way of asking questions that causes other people to react (often more than my attempts to directly influence).

All I said was, "Isn't this going to be our last release before April 1?" Everyone got quiet for a minute, their eyes glinted, and we went from releasing at a reasonable hour for once to deploying at 1 am. Unfortunately the lead engineer (who ended up putting an audio clip of himself knocking on his CRT and saying, "hello? Is anybody out there?" on an idle timeout) and I had worked out all of the off-by-one errors on date calculations in Win32 early in the evening when we were still sharp, only for him to change the numbers in a crisis of faith later in the evening. So the whole thing fired on April 2. Which luckily was a Sunday, so few people using it at work or for classes were affected.

It was all fun and games until the emails started coming in informing us that we may have been hacked. I like easter eggs in my games, but I've only ever mentioned this to coworkers as a cautionary tale about impulses and judgement when tired.


I miss the whimsy of the old web. I suspect even the folks who participated in that whimsy and now turn their nose up at a site with an odd design, or sound are to blame.

Whimsy is still out there to some extent but just not as prevalent.


In case anyone wants to sniff around for some, there's some left in personal sites, often with an explicitly nostalgic vibe: https://yesterweb.org/webring/members.html

https://www.kickscondor.com <- anything in the kicksverse

http://tetrageddon.com/ <-- nathalie lawhead has some wild net art projects


kickstcondor has a cool art style, but from my understanding it isn't exactly a personal site, given it's run by multiple people pretending to be a single person, who actually are doing this for work at Meta / Facebook: https://usesthis.com/interviews/kicks.condor/

I hadn't heard of some of these other ones, and they look cool, thanks for sharing!


"We're on YouTube a lot. But of course. The modern container for personalities. A lot of our characters are blended from vlogs and streams. For whatever reason, we pull a lot from the amateur cigar-smoking community."

One cue that it was a joke is that the "multiple people" are supposedly a brother and sister pair named "Cody" and "Jody". Also the quote above. Also "Jody: We both use a lot of VR to interact with the different people we come out with."

So, again, this is not saying that the kickscondor.com website is run by two Facebook employees, it is explicitly saying that "Cody" and "Jody" have created a fictional personality who has done all the blogging that refers to a single person's life, and that that's kicks condor, and that it's pulled from the amateur cigar-smoking community, and that they interact with him in VR. And also they like Segway shoes.

Were that not enough to cue one that it was Maybe Not To Be Taken Literally, the interview with the "claim" to being from Facebook was preceded by a LARPy revamp of the website where it was all supposed to be sentient Disney IP run amok, and there was a hidden puzzle game (and telnet BBS, the thing was genius), and you could also email completed mazes to a particular address, and then another revamp had the whole thing "seized by the FBI", with police lights and noises...


see also: https://web.archive.org/web/20210201092129/https://kickscond...

> Grape-Nuts Media Lab announces a new partnership with the brilliant duo behind the beloved Kicks Condor intellectual property. This is a new page in our history—a crisp, brittle new page. (By brittle—we do not mean fragile or frail—we mean “firm and crackly” and “feels fun to touch, crumbles in the hand in a satisfying way, similar to a page fabricated from 3-D printed and nutted grape-based matter.”)

> Cody and Jody, the precocious brother and sister team hailing from Facebook Labs, have perfected their recipe for an iconic blogger-type character, one who is very difficult to describe in marketing terms, but which has caught the TiddlyWiki enthusiast worlds by storm.

> By now, it’s very clear that Kicks Condor was a secondary (or tertiary) character in the shelved script for National Treasure 3: How the West Was Done. But lowly beginnings have never stopped the Grape-Nuts® family before. Our founder, Joshua Jonathan Grape-Nuts took his original portfolio of grape-nuts sample textures to the Del Monte/Bloomberg Corp on a northbound Greyhound Bus back in 1863! That’s right in the middle of Civil War I!


These types of links are why I'm still hopeful for the internet as a platform. What a hit of crazy weirdness out of some random persons brain, just excellent.


https://maya.land/blogroll.opml <-- You can open this in your browser and look around at what I follow, the neocities and altweb sections in particular being relevant.

The cool web isn't dead :) and I'm not even sure it shrank -- the less-cool web just got a lot bigger right next to it.


Auto-playing music was obnoxious then and it's obnoxious now. I didn't think there was anything whimsical about it. About as whimsical as getting an air horn blown in my face when I walk into a room.


<EMBED SRC=“mysite.mid” AUTOSTART=TRUE>


It's a funny thing. The Gemini people are so about a retro take on the web without any media you don't explicitly click on, but even twenty years ago, most of the history of the web involved media playing.

(Mind, everyone got sick of unwarned, auto-playing media.)


websites are now meant to be "content" for google or social media. Social media are allowed all the permissions, websites no.


We only like audio or video on a page when the point of the page is audio or video. Youtube. Conference slides. Podcasts.

And even then I have a bad habit, in part due to multiple monitors, of trying to mix tabs and windows and sometimes I cannot for the life of me locate the tab that is playing when someone needs me for something. I may need a new rule about where such tabs need to live (separate window, one monitor, virtual desktop, something).


then you have messaging apps that need to make notifications and they can't. The way google blocks audio at this point is not good.


What would be nice is to be able to grant temporary notifications. Probably 20% of the time I'm not keen on granting permanent rights to some web page to ping me but I might be okay with doing so until I close the tab or the browser restarts.


We hated it back then too.


You hated it back then


There are dozens of us. DOZENS.


Why that audio? Scared, I could have spilled some fine coffee!


I submitted a PR for configurable volume ~2015 [0]. For as often as I see this complaint in threads about the project, it's a shame that the author isn't interested in implementing it.

[0] https://github.com/tholman/elevator.js/pull/64

[1] https://github.com/tholman/elevator.js/issues/113

[2] https://github.com/tholman/elevator.js/issues/123

[2] https://github.com/tholman/elevator.js/issues/124


Yeah, fuck this audio, it literally made me rip my earbuds out because it was so loud and unexpected. Straight up asshole design.


It’s elevator music. Relax and enjoy the ride


Oh but you don't understand! They had to take their earbuds out. Clearly this is a malicious site and should be treated as such! The volume, after all. Yhoiseth, the volume.


The audio is the whole point of the library. Otherwise you could just use

  window.scrollTo({ top: 0, behavior: "smooth" })


Go easier on the fine coffee, then.


Warning: audio


OH, is that what it was. My mistake for having the sound muted I supposed.


For all of us who took that at work in the bathroom.


Hearing phone sounds that come from stalls is the best reason to return to office.


I'd bust out laughing if I heard this in a stall.


[flagged]


Please don't attack others. It's not what this site is for, and it destroys what it is for.

Perhaps you don't owe websites that play audio better, but you owe this community better if you're participating in it.

https://news.ycombinator.com/newsguidelines.html


I'll take "Slight Overreactions" for $1,000 please.

It's a joke, calm your shit.


I bet your cats got really startled.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: