Skip to content

Instantly share code, notes, and snippets.

@slavafomin
Last active December 7, 2016 21:02
Show Gist options
  • Save slavafomin/8f986fee338aa55049164977c1d7866e to your computer and use it in GitHub Desktop.
Save slavafomin/8f986fee338aa55049164977c1d7866e to your computer and use it in GitHub Desktop.
Tilda Cover's Min Width For Video Patch

tilda-scripts-2.6.js

1). Add the following snippet to the cover_init function (before $isMobile is first used):

var minWidthForVideo = parseInt(el.attr('data-min-width-for-video')) || null;
var imageMode = $isMobile;
var windowWidth = $(window).width();
if (minWidthForVideo && windowWidth < minWidthForVideo) {
  imageMode = true;
}

2). Replace $isMobile with imageMode everywhere in this function.

page*.html

Add data-min-width-for-video="800" property to the specific .t-cover__carrier element of your choice.

Replace 800 with any value you like.

That's it!

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