我有简单的Express网站/应用程序,我想在视图/页面之间进行转换。
因此,如果我在/home
并点击/about
页面,该视图将淡出 /home
并淡入> strong> /about
。有任何想法吗?谢谢!
答案 0 :(得分:0)
您需要$.get
调用网址/about
,然后将内容放入您的dom中,例如:
// add click handler to about-link
$('a.about').on('click', function() {
// call /about
$.get('/about', function(data) {
// fadeout content block and empty page content
$('.content').fadeOut().empty();
// add data from /about to content and fadein
$('.content').html(data).fadeIn();
});
});