Reputation: 9428
The lightbox used to work. However, when I tried it on meteor, it is not working any more.
I first add jquery dependency and put jquery.lightbox.js and jquery.lightbox.css to client folder.
$ meteor add jquery
$ ls -l client/js/jquery.lightbox.js
$ ls -l client/css/jquery.lightbox.css
This is the test template and script to use lightbox.
->test.html
<template name="test">
<a href="xxxxxxxx" class="screenshot">
<img src="xxxxxx" alt="Screenshot" class="thumbnail"/>
<span class="screenshot-zoom"></span>
</a>
</template>
->screenshot.js
$(function () {
$(".screenshot").lightbox();
});
If I use it as regular html, it worked. But it is not under meteor. Do I miss anything?
Upvotes: 1
Views: 880
Reputation: 9428
This is what I got from Meteor's dev, however, I did not verify it on new meteor 0.4.0.
http://docs.meteor.com/#meteor_startup
Meteor.startup(function () (
$(".screenshot").lightbox();
});
Upvotes: 0
Reputation: 4693
Starting from Meteor 0.4.0 you can use the Template.myTemplate.rendered
method to do this:
In your case that would be
Template.test.rendered = function() {
if(!this._rendered) {
this._rendered = true;
$(this.find(".screenshot")).lightbox();
}
}
Upvotes: 4