如何单击加载 html 页面的链接,该页面又通过 ajax 加载外部 html 文件?
您好,我想单击导航下的图标,转到portfolio.html 页面,然后在不单击侧边栏的情况下通过ajax 加载外部html 文件。我该怎么做?
http://www.tsakalos-advertising.gr/
这是我的网站
作品集页面我有这个代码
<script type="text/javascript">
$(document).ready(function () {
if (window.location.search == "?istoselides") {
$('#loading_content').load('what-we-do.html/istoselides').fadeIn(1000);
}
if (window.location.search == "?video") {
$('#loading_content').load('what-we-do.html/video').fadeIn(1000);
}
});
</script>
<ul id="icon">
<li id="adv"><a href="what_we_do.html">adv</a></li>
<li id="flyers"><a href="what_we_do.html">flyers</a></li>
<li id="websites"><a href="what_we_do.html?istoselides">websites</a></li>
<li id="video"><a href="what_we_do.html?video">video</a></li>
</ul>
更新 由于某种原因我无法发表评论:( 感谢您的回复,但我不知道该怎么做。不能用jquery完成吗?我根本没有经验。谢谢:D
Hi i want to click on the icons under the navigation that go to the portfolio.html page and then without clicking on the sidebar load via ajax an external html file. How do i do that?
http://www.tsakalos-advertising.gr/
that is my website
portfolio page i have this code
<script type="text/javascript">
$(document).ready(function () {
if (window.location.search == "?istoselides") {
$('#loading_content').load('what-we-do.html/istoselides').fadeIn(1000);
}
if (window.location.search == "?video") {
$('#loading_content').load('what-we-do.html/video').fadeIn(1000);
}
});
</script>
<ul id="icon">
<li id="adv"><a href="what_we_do.html">adv</a></li>
<li id="flyers"><a href="what_we_do.html">flyers</a></li>
<li id="websites"><a href="what_we_do.html?istoselides">websites</a></li>
<li id="video"><a href="what_we_do.html?video">video</a></li>
</ul>
UPDATE
For some reason i cant comment :(
Thanks for your response but i have no idea how to do that. Cant it be done with jquery? Im not experienced at all. Thanks :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个动态 iframe 元素并将其 src 设置为外部 HTML。
例如:
#container
是您希望 iframe 所在的位置。Create a dynamic iframe element and set its src to the external HTML.
Something like:
Where
#container
is where you want the iframe to be.