Created
July 19, 2018 08:54
-
-
Save elricco/52eda4083a7bebfd5050fa758013cb21 to your computer and use it in GitHub Desktop.
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
$(function() { | |
function fullpageElement($indicator, $selector) { | |
let indicatorHeight = $indicator.height(); | |
let indicatorWidth = $indicator.width(); | |
let indicator = indicatorHeight; | |
let $selectedElement = $selector; | |
if((100 * indicatorHeight) / indicatorWidth < 56.25) { | |
indicator = indicatorWidth; | |
$selectedElement.height((indicator/100)*56.25); | |
$selectedElement.width(indicator); | |
} else { | |
indicator = indicatorHeight; | |
$selectedElement.height(indicator); | |
$selectedElement.width((indicator/56.25)*100); | |
} | |
positionElements($selectedElement); | |
} | |
function positionElements(selector) { | |
selector.each(function(index) { | |
var thewidth = $(this).width() / 2; | |
var theheight = $(this).height() / 2; | |
//console.log(thewidth + ' ' + theheight); | |
$(this).css({ | |
'margin-left':-thewidth, | |
'margin-top':-theheight | |
}); | |
}); | |
} | |
$(window).on('resize', function() { | |
fullpageElement($('#index-login'), $('#video-fullpage')); | |
console.log('resize'); | |
}); | |
fullpageElement($('#index-login'), $('#video-fullpage')); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment