Archive: Namaste PHP AMQP framework v1.0 (2017-2020)
952 days continuous production uptime, 40k+ tp/s single node. Original corpo Bitbucket history not included — clean archive commit.
This commit is contained in:
64
html/js/modules (optional)/video-bg.js
Normal file
64
html/js/modules (optional)/video-bg.js
Normal file
@@ -0,0 +1,64 @@
|
||||
// VIDEO BACKGROUND
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
scaleVideoContainer();
|
||||
|
||||
initBannerVideoSize('.video-container .poster img');
|
||||
initBannerVideoSize('.video-container .filter');
|
||||
initBannerVideoSize('.video-container video');
|
||||
|
||||
$(window).on('resize', function() {
|
||||
scaleVideoContainer();
|
||||
scaleBannerVideoSize('.video-container .poster img');
|
||||
scaleBannerVideoSize('.video-container .filter');
|
||||
scaleBannerVideoSize('.video-container video');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function scaleVideoContainer() {
|
||||
|
||||
var height = $(window).height() + 5;
|
||||
var unitHeight = parseInt(height) + 'px';
|
||||
$('.homepage-hero-module').css('height',unitHeight);
|
||||
|
||||
}
|
||||
|
||||
function initBannerVideoSize(element){
|
||||
|
||||
$(element).each(function(){
|
||||
$(this).data('height', $(this).height());
|
||||
$(this).data('width', $(this).width());
|
||||
});
|
||||
|
||||
scaleBannerVideoSize(element);
|
||||
|
||||
}
|
||||
|
||||
function scaleBannerVideoSize(element){
|
||||
|
||||
var windowWidth = $(window).width(),
|
||||
windowHeight = $(window).height() + 5,
|
||||
videoWidth,
|
||||
videoHeight;
|
||||
|
||||
/* console.log(windowHeight); */
|
||||
|
||||
$(element).each(function(){
|
||||
var videoAspectRatio = $(this).data('height')/$(this).data('width');
|
||||
|
||||
$(this).width(windowWidth);
|
||||
|
||||
if(windowWidth < 1000){
|
||||
videoHeight = windowHeight;
|
||||
videoWidth = videoHeight / videoAspectRatio;
|
||||
$(this).css({'margin-top' : 0, 'margin-left' : -(videoWidth - windowWidth) / 2 + 'px'});
|
||||
|
||||
$(this).width(videoWidth).height(videoHeight);
|
||||
}
|
||||
|
||||
$('.homepage-hero-module .video-container video').addClass('fadeIn animated');
|
||||
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user