Executing onAfterRoute event on first visit


The event executes when I click on a link to navigate to that particular page but not when I go directly to that page. How can I make it execute the code in both cases?



Can you post an example


I want to execute the setDefaultCSS for every page I visit. This code will only work if I navigate from one page and click to navigate to a different page.

if (Meteor.isClient) {
setDefaultCSS = function() {
switch(Router.current().route.getName()) {
case “home”:
//this page handles the movement of the footer
$("#footer").css(“top”, getBottomOfElement($(".nav")));




What you should do is when your template is rendered run your animation function like so

Template.bottomNav.onRendered(function () {
  var instance = this;

if you would like to do full page animation a great package to use would be https://github.com/ccorcos/meteor-transitioner


I do not think I have made it clear what I am trying to achieve. I’ve opened a new thread to try and find the problem elsewhere. Thanks