单击将 a) 滚动到 div,b) 打开所述 div,c) 将 html 从另一个页面加载到该 div 中。如何?
我已经有了“滚动到”和切换功能:
$("a.view").click(function(){
$("#content").slideToggle("slow");
return false;
});
并且滚动是通过 这个方便的小插件。
现在我如何从另一个页面加载一些 html 到这个新打开的名为 #content 的 div 中。我到处尝试了一些东西,但似乎无法让它发挥作用。
有什么想法吗?
I already have the "scroll to" and toggle functions in place:
$("a.view").click(function(){
$("#content").slideToggle("slow");
return false;
});
And the scrolling is taken care of via this handy little plugin.
Now how do I load some html from another page into this newly opened div called #content. I've tried a few things here and there but just can't seem to get it to work.
Any ideas please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 jQuery 非常简单。
您还可以“部分”加载数据,例如
仅加载 file.html 中 id 为“#container”的元素。
参考:.load()
Pretty trivial using jQuery.
You may also "partial" load data, for instance
will only load the element with the id `#container' out of file.html.
Ref.: .load()