Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery iron router使用onBefore和onAfter操作添加css动画_Jquery_Meteor_Iron Router - Fatal编程技术网

Jquery iron router使用onBefore和onAfter操作添加css动画

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 (

如何使用iron router制作动画
加载页面时会添加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)