Created
August 20, 2014 00:34
-
-
Save mishelen/add0b4ed8795375b7a64 to your computer and use it in GitHub Desktop.
Mixin for video on all container == background video. Миксина для заполнения видео-бэкграундом.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin stretching-pos($type-pos: absolute) { | |
| left: 0;top: 0;right: 0;bottom: 0; | |
| position: $type-pos; | |
| } | |
| @mixin stretching-hw($type-pos: absolute) { | |
| height: 100%; width: 100%; | |
| position: $type-pos; | |
| } | |
| #video-bg { | |
| @include stretching-pos; | |
| overflow: hidden; | |
| > video { | |
| @include stretching-hw; | |
| top: 0; | |
| left: 0; | |
| @media (min-aspect-ratio: 16/9) {height: 300%; top: -100%;} | |
| @media (max-aspect-ratio: 16/9) {width: 300%; left: -100%;} | |
| @supports (object-fit: cover) { | |
| top: 0; left: 0; | |
| width: 100%; height: 100%; | |
| object-fit: cover; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| video(loop, autoplay) | |
| source(type='video/mp4', src='http://fvsch.com/code/video-background/video.mp4') | |
| source(type='video/webm', src='http://fvsch.com/code/video-background/video.webm') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment