美文网首页
barbajs-event

barbajs-event

作者: 这是我用来记录技术的一个博客 | 来源:发表于2017-12-19 16:47 被阅读28次
    名称 参数 时机
    linkClicked HTMLElement, MouseEvent 用户点击一个PJAX链接
    initStateChange currentStatus 链接刚刚改变
    newPageReady currentStatus, prevStatus, HTMLElementContainer, newPageRawHTML 新的container已经加载并注入wrapper
    transitionCompleted currentStatus[, prevStatus] 转场动画完成 旧场景被删除

    在页面转场的所有生命周期中,barba会发出一系列有用信息的事件:

    名称 参数 时机
    linkClicked HTMLElement, MouseEvent 用户点击一个PJAX链接
    initStateChange currentStatus 链接刚刚改变
    newPageReady currentStatus, prevStatus, HTMLElementContainer, newPageRawHTML 新的container已经加载并注入wrapper
    transitionCompleted currentStatus[, prevStatus] 转场动画完成 旧场景被删除

    currentStatus 和 prevStatus 就是一个装有页面url和最终命名空间的简单对象。
    监听事件可以这么写:

    Barba.Dispatcher.on(eventName, function() {
      //your listener
    });
    

    相关文章

      网友评论

          本文标题:barbajs-event

          本文链接:https://www.haomeiwen.com/subject/wdxiwxtx.html