jQuery實現垂直居中+iframe高度自適應

  • 2019 年 10 月 6 日
  • 筆記

jQuery垂直居中

if ($(".ClassName").height() = $(window).height()) $(".ClassName").css("marginTop",$(window).height()/2 - $(".ClassName").height()/2);

jQuery iframe高度自適應

$(document).ready(    function()    {      $(window).resize(function(){$(".iframeName").height($(window).height());});      $(".iframeName").load(function(){$(this).height($(window).height());});    }  );