jQuery iframe隐藏/显示 [英] jQuery iframe hide/show

查看:295
本文介绍了jQuery iframe隐藏/显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我正在编码一个网站,现在停留在jQuery部分,这并不是我最强项. 该网站包含一个顶部菜单导航栏:

Well im coding a site, and now stuck at the jQuery part, which aint my strongest thing. The site contains a top-menu nav-bar:

<a href="aboutus.html" target="iframe"><img class="tab1" src="#.png"></a>
<a href="menu.html" target="iframe"><img class="tab2" src="#.png"></a>
<a href="gallery.html" target="iframe"><img class="tab3" src="#.png"></a>
<a href="shop.html" target="iframe"><img class="tab5" src="#.png"></a>
<a href="links.html" target="iframe"><img class="tab6" src="#.png"></a>
<a href="contact.html" target="iframe"><img class="tab7" src="#.png"></a>
</div>

在页面中间有一个iframe,可在导航点击时加载新的html. 加载索引页后,在单击导航之前不应看到iframe. 因此,我得到了:css中的iframe {display:none;}.

And a iframe in the middle of the page, which loads the new html on nav click. When the index page loads, the iframe should not be seen before nav click. So ive got: iframe {display:none;} in css.

因此,我需要jQuery编码方面的帮助才能在单击导航时显示iframe. 还可以使iframe再次隐藏.

So, i need help with jQuery coding to show the iframe on nav click. Also with an effect to make the iframe hide again.

祝一切顺利.

推荐答案

假定<iframe>idcontentIframe,您可以执行以下操作:

Assuming that the <iframe> has an id of contentIframe you could do the following:

显示<iframe>:

$("#contentIframe").show();

隐藏<iframe>:

$("#contentIframe").hide();

这篇关于jQuery iframe隐藏/显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆