简体   繁体   English

jquery - 滑动 iframe 隐藏一个 div

[英]jquery - sliding iframe hiding a div

My page is having left side menu and right side content with links.我的页面有左侧菜单和带有链接的右侧内容。 When the links in the content are clicked then i need an iframe loading the content in the link and come up so that it covers the right side div having the content.当点击内容中的链接时,我需要一个 iframe 加载链接中的内容并出现,以便它覆盖具有内容的右侧 div。

This iframe should be minimized when not needed and should be visible like a bar at the bottom always floating and when reached bottom of page it should be visible above the footer bar.这个 iframe 应该在不需要时最小化,并且应该像底部的条一样可见,始终浮动,当到达页面底部时,它应该在页脚栏上方可见。

Can anyone suggest me how to do this.谁能建议我如何做到这一点。 If example is provided that will be much better.如果提供示例会更好。

Thanks, Sandeep谢谢,桑迪普

Im attaching a demo layout of what i wanted.我附上了我想要的演示布局。

演示

If you structure your right side content with a containing div, and within that div make a nested div that holds your regular content and an iframe;如果您使用包含 div 构建右侧内容,并在该 div 中创建一个包含常规内容和 iframe 的嵌套 div; then you can setup click handlers for your link that will hide the nested div and show the iframe:然后你可以为你的链接设置点击处理程序,它将隐藏嵌套的 div 并显示 iframe:

$(document).ready(function() {
    $('#inner_div > a').live('click', function() {
        $('#inner_div').slideUp();//just an example animation, you can set whatever attributes you would like with jquery, like just change the height with .css({height: '0px'})
        $('#iframe_id').slideDown();
    });
});
<div id="outer_div">
    <div id="inner_div">
        <a href="some_link.html" target="iframe_id">Link Text</a>
    </div>
    <iframe id="iframe_id" style="display:none;"></iframe>
</div>

----EDIT---- - - 编辑 - -

As for the floating bar attached to the bottom of the page:至于附在页面底部的浮动条:

<div id="floating_footer" style="position: absolute; bottom: 0px; right: 0px; width: 90%; height: 50px; background-color:#069;"></div>

And if you want to hide this "floating div" when the iframe shows up, just add the following to the javascript code (right with the other slideUp/slideDown code):如果你想在 iframe 出现时隐藏这个“浮动 div”,只需将以下内容添加到 javascript 代码(与其他 slideUp/slideDown 代码一起):

$('#floating_footer').slideUp();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM