I'm working with a team that makes heavy use of the "fade-in" effect to animate the rendering of images, and even text sometimes.
You can see the kind of effect I'm describing here: http://www.seafireresidencescayman.com/seven-mile-beach
The fade-in isn't really "my thing", but what actually troubles me the most is that all implementations that I've seen so far, make the site pretty useless when javascript isn't enabled.
Here's what the same site above looks like without javascript:
My team's preferred tool for this is AOS, which uses more-or-less the same approach that I see elsewhere:
If javascript isn't available, #2 doesn't happen and the content stays hidden. Not good.
I'm interested to find a way to accomplish the same/similar effect, but in a way that fails gracefully if javascript isn't available. I'm guessing the tricky part is to keep the content from flickering initially, and that's why most approaches need to hide the content "by default." So maybe it's not as simple as just hiding things with javascript instead of CSS...
Is there a non-evil way to do this?
I agree with @RobG's comment, the only progressive enhancement way of accomplishing this is to not hide the content with CSS, but to use JS to hide it. This could easily be done without jQuery, but for the sake of brevity...
<h1 class="fade-in">Yay, it's 2002!</h1>
<div>
<img class="fade-in" src="/path/to/cat.gif" />
</div>
<script>
var $faded = $('.fade-in');
$faded.hide();
// could easily use a more intelligent mechanism for determining when to load
$('img.fade-in').on('load', function() {
$faded.fadeIn();
});
</script>