Trying to recreate Medium's Fade In / Out Fixed "Applause" Effect. (Javascript Help) Stuck

On Medium you'll notice there's the fixed applause button and social media icons. When image width is wide they fade out and fade back in when there is no wide image:

Example here:

(If you scroll down you'll notice, the fixed clapper fade in and out)

How would you recreate this? Thanks