您要
ajax为链接设置。要求:
- 为链接编写处理程序。
- 当有人单击链接(重定向到页面)时,我们必须取消浏览器的默认行为。
- 从服务器上删除旧数据ajax并重新制作
#ajax-wrap
。 - 通过ajax加载远程页面并将其设置为
#ajax-wrap
。 - 现在将其向下滑动。
// document Ready$(function () { // attaching click handler to links $("a.home-right").click(function (e) { // cancel the default behaviour e.preventDefault(); // get the address of the link var href = $(this).attr('href'); // getting the desired element for working with it later var $wrap = $('#ajax-wrap'); $wrap // removing old data .html('') // slide it up .slideUp() // load the remote page .load(href + ' #content', function () { // now slide it down $wrap.slideDown(); }); });});


