【问题标题】:How to make page transition between Express views?如何在 Express 视图之间进行页面转换?
【发布时间】:2014-01-26 21:59:42
【问题描述】:

我有简单的Express 网站/应用程序,我想在视图/页面之间进行转换。

所以如果我在/home 并点击/about 页面,视图将淡出 /home 并淡入 /about。有任何想法吗?谢谢!

【问题讨论】:

    标签: jquery node.js express transition


    【解决方案1】:

    你需要一个 $.get 调用 url /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();
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-28
      • 2020-10-29
      • 1970-01-01
      • 1970-01-01
      • 2020-06-28
      • 1970-01-01
      相关资源
      最近更新 更多