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 开发者_JAVA技巧please?
Pretty trivial using jQuery.
$('#content').load('path/file.html', function() {
// done
});
You may also "partial" load data, for instance
$('#content').load('path/file.html #container', function() {
// done
});
will only load the element with the id `#container' out of file.html.
Ref.: .load()
精彩评论