【问题标题】:Unable to navigate sidebar content when I use iframes for each one of them当我为每个侧边栏内容使用 iframe 时,无法导航侧边栏内容
【发布时间】:2021-02-04 16:28:29
【问题描述】:

所以我的页面有一个顶部导航栏、一个侧栏和右侧的内容。现在我设计了我的页面,但我觉得它是重复的,所以我试图在右侧使用 iframe(当侧边栏中的任何链接更改时会更改的 iframe)。我希望你能明白。

现在,问题是我可以从第一个 iframe 导航到第二个 iframe 标记,但不能从第二个到第一个 iframe。

这是代码。 HTML:


        <div class="container-fluid side-content">

          <iframe src="carsx-iframe.html" id="car-frame" height="100%" width="100%" style="outline: none; border:none; "></iframe>

          <iframe src="edit-profile-iframe.html" id="edit-prof" height="1050px" width="100%" style="outline: none; border-style: none;"></iframe>

        </div>

Js:

$(document).ready(function() {
  $("#edit-prof-click").click(function() {
    $("#edit-prof").show();
  });
});

 $(document).ready(function() {
  $("#cars").click(function() {
    $("#car-frame").show();
  });
});

CSS

#edit-prof{
  display: none;
}

#car-frame{
  display: none;
}

【问题讨论】:

    标签: javascript html css iframe dynamic


    【解决方案1】:

    您需要隐藏第二个 div 以显示第一个,而在尝试显示第一个时您没有这样做。

    尝试添加类似的东西

    $("#car-frame").hide();
    

    在显示第一个 iframe 之前。

    【讨论】:

      猜你喜欢
      • 2016-01-06
      • 2016-10-28
      • 1970-01-01
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多