Skip to content

Instantly share code, notes, and snippets.

@tmcw
Last active December 23, 2015 11:09
Show Gist options
  • Save tmcw/6626569 to your computer and use it in GitHub Desktop.
Save tmcw/6626569 to your computer and use it in GitHub Desktop.

Hey Washington Post!

Here's a tiny tweak to your awesome article about DC building heights

Here where you're swapping images of buildings, there's a flash to white between the swap, since one is going to 0 and the other is going to 1 and they don't always match up perfectly time-wise.

new_img.stop().fadeTo(400,1)
  .siblings('img').stop().fadeTo(400,0);

It's easy to remove this flash and to make the animation a bit smoother, by using the complete callback on fadeTo -

new_img.stop().fadeTo(400,1, function() {
    new_img.siblings('img').stop().fadeTo(400,0);
});

Try it out - nice work on this piece!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment