【问题标题】:Hide div when iframe gets to certain height automatically当 iframe 自动达到特定高度时隐藏 div
【发布时间】:2018-01-31 16:48:25
【问题描述】:

我的用户在我们的网站上进行了预约,当 iframe 更改了高度时,该预约会更改 iframe 的高度我想自动隐藏 iframe 上方的内容。这是我到目前为止的限制是它仅适用于以下事件,但我希望它动态隐藏而不是页面调整大小或滚动,因为这些事件不会发生

$(window).on('load resize scroll', function() {
  if ($(".remove-text").height() >= 582) {
    $("#execphp-30, #execphp-47, #execphp-48").hide();
  } else {
    $("#execphp-30, #execphp-47, #execphp-48").show();
  };
});

我使用iframeresizer js插件动态检测更新iframe的高度

【问题讨论】:

标签: javascript jquery html css iframe


【解决方案1】:
<script>
jQuery(function($) {

$(window).on('DOMSubtreeModified', function() {
  if ($(".remove-text").height() >= 582) {
    $("#execphp-30, #execphp-47, #execphp-48").hide();
  } else {
    $("#execphp-30, #execphp-47, #execphp-48").show();
  };
});

});
</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-03
    • 2016-01-02
    • 2013-02-02
    相关资源
    最近更新 更多