Reputation: 1744
Cheers! I am trying to implement popup window with Lightbox_me plugin in my Ruby On Rails application. I have downloaded jquery.lightbox_me.js
, put it to app/assets/javascripts
,
add //= require jquery.lightbox_me
in application.js
file, and in home.js.coffee
(I've HomeController) I do stuff like this:
`$(".popup-button").click (e) ->
alert "!!!"
$(".download_layout").lightbox_me centered: true
e.preventDefault()
alert shows normally, but .lightbox_me doesn't work. Whats the problem?
EDIT: application.js
//.......
//= require jquery
//= require jquery_ujs
//= require jquery.lightbox_me
//= require bootstrap
//= require_tree .
Upvotes: 1
Views: 765
Reputation: 4315
Try to stick to the CoffeeScript syntax :
$(document).ready ->
$(".popup-button").click (e) ->
$("#download_layout").lightbox_me
centered: true
e.preventDefault()
EDIT : Don't forget to place this very important string on the top of your .js.coffee
(I have replicated your code on my machine and it works) :
$(document).ready ->
Upvotes: 1