ashleydw / lightbox

A lightbox gallery plugin for Bootstrap
http://ashleydw.github.io/lightbox
MIT License
1.85k stars 1.3k forks source link

When used with Turbolinks 5 lightbox creates multiple modal views #193

Closed itspradhan closed 8 years ago

itspradhan commented 8 years ago

First of all I really love the plugin, Thanks so much for that.

So the issue occurs when I move from first main page to another, the ekko-lightbox.min.js is loaded multiple types using turbolinks 5 because of which when I click on the image it opens multiple modals so you have to close them one by one.

Thanks, George

ashleydw commented 8 years ago

You'll be better off asking on stackoverflow as your issue isn't with the lightbox but with turbolinks.

acegilz commented 7 years ago

@itspradhan have you found a way to fix this?

Genecode commented 5 years ago

@itspradhan have you found a way to fix this?

Put your ekko script in pipeline js folders (for me - app\assets\javascript\myfile.coffee)

$(document).on 'click', '[data-toggle="lightbox"]', (event) ->
  event.preventDefault()
  $(this).ekkoLightbox()
  return