a seal with a cursive L

G. Lucas Roe

Making Gfycat Play Nice in Responsive Design

When writing tutorials, mini animations can save a lot of time and overexplanation. In my first Axure tutorial, I used some screen recordings to walk through some of the most complex pieces of the process.

I could have just uploaded some videos, but having a looping gif is nice because repeats so someone reading can watch the tutorial happen repeatedly and get the gist of what’s happening without requiring any interaction.

To save on bandwidth and give the user more control, I opted to go with Gfycat. The javascript embed is very easy to set up and serves different files to different browsers, so it sounded perfect… right?

Side note: For recording gifs I have 2 recommendations for Mac Users: GifGrabber for fast, simple, and short and then I use Quicktime Screen recordings for longer things.

Gfycat Don’t Play Nice.

When they’re standalone, the gfycat pieces seem to work just fine. As soon as I put them in my template however, the display went haywire and it broke my mobile site. Here are the things that I did to make it work, written in SCSS

div.gfyitem {
    width:100%;
    div:not(.gfyCtrlBox):not(.gfyCtrlTabPull){
        width: 100% !important;
        max-width:100% !important;
        height: auto !important;
        .gfyPreLoadCanvas{
            display: none;
        }
        video{
            position:relative !important;
            height: auto !important;
            margin-top: 0;
        }
    }
    .gfyCtrlBox{
        margin-bottom:10px !important;
        .gfyCtrlPause, .gfyCtrlReverse, .gfyCtrlSlower, .gfyCtrlFaster{
        width:15px;
        height:15px;
        margin-top:0;
        display:inline;
        }
    }
    .gfyGif{
        position:relative !important;
    }
}

Enjoy your responsive gfys

*This one isn't mine, I just thought it was pretty.*