📜  jquery calc height based on width - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:30.242000             🧑  作者: Mango

代码示例1
$(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
  })
})