Pjax animations

前端 未结 3 1593
感情败类
感情败类 2021-02-14 02:54

I finally got pjax working, but I have another question.. How do I add some jquery animation like fadeout/slideup old content and fadein/slidedown new content?

By defaul

3条回答
  •  清歌不尽
    2021-02-14 03:04

    Basically, you have a bunch of events to latch on to and do as you like. Here's a basic fadeIn and fadeOut version using the pjax:start and pjax:end as triggers.

    $(document)
      .on('pjax:start', function() { $('#main').fadeOut(200); })
      .on('pjax:end',   function() { $('#main').fadeIn(200); })
    

    Obviously you would swap #main for the container element you're swapping content in and out of.

提交回复
热议问题