Jquery iron router使用onBefore和onAfter操作添加css动画
如何使用iron router制作动画Jquery iron router使用onBefore和onAfter操作添加css动画,jquery,meteor,iron-router,Jquery,Meteor,Iron Router,如何使用iron router制作动画 加载页面时会添加css类 css来自 动画显示一次,但导航到其他页面不会再次触发动画 路由器、咖啡 Router.map -> @route "page1", path: "/", @route "page2", path: "/page2", animateContentOut = (pause) -> $('#layout').addClass 'animated fadeIn' console.log (
加载页面时会添加css类
css来自
动画显示一次,但导航到其他页面不会再次触发动画 路由器、咖啡
Router.map ->
@route "page1",
path: "/",
@route "page2",
path: "/page2",
animateContentOut = (pause) ->
$('#layout').addClass 'animated fadeIn'
console.log ('fade in')
animateContentIn = ->
$('#layout').removeClass 'animated fadeIn'
console.log ('fade Out')
this.next()
Router.onAfterAction animateContentOut
Router.onBeforeAction animateContentIn
Router.onBeforeAction ->
$('#layout').css('display', 'none')
this.next()
Router.onAfterAction ->
$('#layout').velocity('transition.fadeIn',500)
在呈现页面之前,会立即调用这些操作 您需要在模板的渲染函数中执行此操作 请看这里: 这起作用了 流星添加ccorcos:传送者 Router.cofee
Router.map ->
@route "page1",
path: "/",
@route "page2",
path: "/page2",
animateContentOut = (pause) ->
$('#layout').addClass 'animated fadeIn'
console.log ('fade in')
animateContentIn = ->
$('#layout').removeClass 'animated fadeIn'
console.log ('fade Out')
this.next()
Router.onAfterAction animateContentOut
Router.onBeforeAction animateContentIn
Router.onBeforeAction ->
$('#layout').css('display', 'none')
this.next()
Router.onAfterAction ->
$('#layout').velocity('transition.fadeIn',500)