Skip to content

24 ways to impress your friends

Vote down?

Rob Tarr

I think this is great, I did something recently when loading in twitter follower avatars. Paul Hayes recently wrote an article (http://www.paulrhayes.com/2011-11/use-css-transitions-to-link-media-queries-and-javascript/) about triggering JavaScript based on events fired from CSS properties. It’s still not a perfect solution, but I think it will help with these sorts of problems.

Being able to trigger JavaScript events based on media queries allows us to be sure that if the page triggered a smaller media query when it loaded and then the browser was resized, that the additional content gets loaded in. Jeremy’s if statement works great on page load, but won’t load the content if the page size changes.