It looks like you’re trying to shoehorn some non-Meteor code into Meteor. Which generally doesn’t work that well.
Without seeing the included scripts, it’s hard to say for sure, but I suspect what’s going on is that your scripts are running prior to iron:router rendering the layout template. That is, the iron:router template hasn’t rendered as of the time your scripts run, so there’s no navbar to change.
Again, hard to tell without seeing your app, but I’d try the following:
(1) Create a folder called client
in your main meteor app directory and move jquery.teletype.min.js
and client.slideshow.js
there, if you haven’t already.
(2) If you have references to these javascript files in the head
of your app, remove them. Meteor should automatically ensure that all Javascript files in the client
folder of your app are available to the client (and only the client – see http://docs.meteor.com/#/full/structuringyourapp for more details about organizing your project).
(3) I’m assuming you have a navbar template that looks like this:
<template name="navbar">
<div class="navbar">Change Me!</div>
</template>
If that’s the case, then you’ll want to run the code that modifies your navbar text in the template’s rendered function, like so:
Template.navbar.rendered = function() {
// Replace with your own code
this.$('.navbar').text('New Text!');
}
For more info about rendered
, see http://docs.meteor.com/#/full/template_rendered.
NB: If all you’re doing is changing the text of a navbar, consider doing it reactively by just altering the data context. That is, if your navbar template looks like this:
<template name="navbar">{{ title }}</template>
Then, in iron:router, render the template with a data context with the title set appropriately (see https://github.com/iron-meteor/iron-router/blob/devel/Guide.md#rendering-templates-with-data about how to change the data context in iron:router).