Add fitvids

This commit is contained in:
David Darnes 2019-11-08 16:49:55 +07:00
parent 9587fbce06
commit 49f33a5fe0
7 changed files with 114 additions and 15 deletions

View file

@ -38,6 +38,7 @@
{{#contentFor "scripts"}}
<script src="{{asset "built/jquery.fitvids.js"}}"></script>
<script>
var images = document.querySelectorAll('.kg-gallery-image img');
images.forEach(function (image) {
@ -46,7 +47,13 @@ images.forEach(function (image) {
var height = image.attributes.height.value;
var ratio = width / height;
container.style.flex = ratio + ' 1 0%';
})
});
$(document).ready(function () {
// FitVids - start
var $postContent = $(".gh-content");
$postContent.fitVids();
});
</script>
{{/contentFor}}