开发者

Click will a) scroll to div, b) open said div and c) load html from another page into that div. How?

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜