Last active
July 23, 2020 14:11
-
-
Save glennyboy/3829c4af0d6fcf86a3b920ffe4933954 to your computer and use it in GitHub Desktop.
Height Always the same as Width
This file contains 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
// 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