Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Height Always the same as Width
// Best - height always same as width
$(window).on("focus load resize scroll",function(){
$('.width-height').each(function() {
$(this).height($(this).width());
});
// height always same as width
var divWidth = $('.width-height').width();
$(window).on("focus load resize scroll",function(){
$('.width-height').css({"height": divWidth, "max-height": divWidth});
});
// height always same as width
var divWidth = $('.width-height').width();
$(window).on("focus load resize scroll",function(){
$('.width-height').height(divWidth);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.