Guest User

Untitled

a guest
Jul 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. $(function() {
  2.  
  3. function fullpageElement($indicator, $selector) {
  4. let indicatorHeight = $indicator.height();
  5. let indicatorWidth = $indicator.width();
  6. let indicator = indicatorHeight;
  7. let $selectedElement = $selector;
  8. if((100 * indicatorHeight) / indicatorWidth < 56.25) {
  9. indicator = indicatorWidth;
  10. $selectedElement.height((indicator/100)*56.25);
  11. $selectedElement.width(indicator);
  12. } else {
  13. indicator = indicatorHeight;
  14. $selectedElement.height(indicator);
  15. $selectedElement.width((indicator/56.25)*100);
  16.  
  17. }
  18. positionElements($selectedElement);
  19. }
  20.  
  21. function positionElements(selector) {
  22. selector.each(function(index) {
  23. var thewidth = $(this).width() / 2;
  24. var theheight = $(this).height() / 2;
  25. //console.log(thewidth + ' ' + theheight);
  26. $(this).css({
  27. 'margin-left':-thewidth,
  28. 'margin-top':-theheight
  29. });
  30. });
  31. }
  32.  
  33. $(window).on('resize', function() {
  34. fullpageElement($('#index-login'), $('#video-fullpage'));
  35. console.log('resize');
  36. });
  37.  
  38. fullpageElement($('#index-login'), $('#video-fullpage'));
  39. })
Add Comment
Please, Sign In to add comment