$('.page').on('click',function(){
$(this).next('.content').css('display','block');
$('body').empty('');
var post = $(this).next('.content').css('display','block');
post.appendTo('body');
});
如何清除除 .content 之外的所有其他内容,这样就像您导航到新页面一样?我尝试了上面的代码,但我的逻辑有缺陷。我是 jquery 新手。
最佳答案
$('.page').on('click',function(){
$('body').empty();
// you have just deleted the page, how would you find other objects in the page ?
// $(this).next('.content').css('display','block');
// Try to .append new elements to the body
});
关于javascript - 使用 html() 进行 Jquery 导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27698855/