Lightbox sample


#1

How lightbox is running, can you please provide an example:

meteor add lightbox

.html
{{> test}}

<template name="test">
<a href="http://google.com" class="screenshot"><span class="screenshot-zoom">test</span></a>
</template>

.js
Template.test.rendered = function() {
$(this.find(".screenshot")).lightbox();
};

Lightbox is not coming up.


#2

Can you run it from console? i.e: $(".screenshot").lightbox();
P.S. you can use this.$ inside rendered callback: this.$(".screenshot").lightbox();


#3

.js

I am using the following block:

  Template.test.rendered = function() {
    if(!this._rendered) {
      this._rendered = true;
      //this.$(".screenshot").lightbox();
      $(".screenshot").lightbox(); // Tried it as well
    }
  };

and tried this one as well:

  Meteor.startup(function () {
    // code to run on server at startup
    $(".screenshot").lightbox();
  });

meteor list
autopublish 1.0.3 Publish the entire database to all clients
insecure 1.0.3 Allow all database writes by default
jquery 1.11.3_2 Manipulate the DOM using CSS selectors
meteor-platform 1.2.2 Include a standard set of Meteor packages in your app

I get the following when running them:
“TypeError: $(…).lightbox is not a function”

Thanks for the reply.


#4

Can you manually init a lightbox after all DOM has been rendered from BROWSER CONSOLE? $(".screenshot").lightbox();? Is it works? Do you see the lightbox? May be your lightbox plugin doesnt work?