Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(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'));
- })
Add Comment
Please, Sign In to add comment