almino8

Redimensiona de acordo com o maior

Jun 9th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function () {
  2.     var headerHeight = 0;
  3.     var segmentHeight = 0;
  4.  
  5.     $('#participante-form .column > .ui.header').each(function () {
  6.         if ($(this).height() > headerHeight) {
  7.             headerHeight = $(this).height();
  8.         }
  9.     });
  10.  
  11.     $('#participante-form .column > .ui.segment').each(function () {
  12.         if ($(this).height() > segmentHeight) {
  13.             segmentHeight = $(this).height();
  14.         }
  15.     });
  16.  
  17.     $(window).resize(function () {
  18.         var mobile = !window.matchMedia('(max-width: 768px)').matches;
  19.         $('#participante-form .column > .ui.header').height(mobile ? headerHeight : 'auto');
  20.         $('#participante-form .column > .ui.segment').height(mobile ? segmentHeight : 'auto');
  21.     });
  22.  
  23.     $(document).trigger('resize');
  24. });
Advertisement
Add Comment
Please, Sign In to add comment