Created
October 28, 2016 23:41
-
-
Save patrickisgreat/4c584c0339ff9d608c47d6fc41399d66 to your computer and use it in GitHub Desktop.
Resizing stuff to make it more responsiverizedly for RGarcia
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
//▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼ SCREEN-SIZE LOGIC ▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲// | |
$(document).ready(function() { | |
$window = $(window); | |
function makeColumnHeightsMatch(container) { | |
let elementHeights = $(container).map(function() { | |
return $(this).height(); | |
}).get(); | |
let maxHeight = Math.max.apply(null, elementHeights); | |
_.each($(container).contents(), function(el) { | |
if ($(el).hasClass('columnElementClass')) { | |
$(el).height(maxHeight); | |
} | |
}); | |
} | |
function doResize() { | |
var tallestColumn = $(.container-element).find( | |
var frameHeight = $window.height(); | |
var frameWidth = $window.width(); | |
//screen ratio if you need it -- easy way to do mobile detection for various devices | |
var screenRatio = (frameWidth / frameHeight).toFixed(2); | |
console.log(frameWidth); | |
//profile columns | |
if (frameWidth <= 1139 && frameWidth > 869) { | |
$('.some-dom-element').css({'margin-left' : '10%'}); | |
} else { | |
$('.some-dom-element').css({'margin-left' : ''}); | |
} | |
} | |
doResize(); //class first when window is ready, before splash fades off | |
$(window).resize(function() { | |
setTimeout(function(){ | |
doResize(); | |
doResizeProfilePictures(); | |
}, 50); //small timeout helps older ie keep up | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment