Answers for "jquery calculate height of element"

1

jquery calc height based on width

$(function() {
  var myDivWidth = $(".main-div").css("width") + "px";
  // the variable will now have our div width
  $(".main-div").css("height", myDivWidth)
  // Another Way
  $(".main-div").css({
    "height": myDivWidth
  })
})
Posted by: Guest on June-12-2021
3

jquery get height of element

let height = ($(window).height() || $("body").height());
Posted by: Guest on November-12-2020

Code answers related to "jquery calculate height of element"

Code answers related to "Javascript"

Browse Popular Code Answers by Language