Reputation: 374
I'm running into a strange problem with Magnific popup. I have two separate pages with links to the same Magnific-enabled popups.
I have the fixedContentPos
option set to true
so the background doesn't scroll when the popup is up. In every instance I've outlined above where the popup doesn't come up, the background doesn't scroll as if the popup were there. I've looked in inspector, and see the overflow:hidden
attribute attached that's stopping the background scroll. However, the popup DOM elements are not there.
This is a Rails site btw. I tested out the same Javascript code on a static version, and it works as intended, so I'm wondering if this has something to do with how Rails handles routing?
Any help would be appreciated!
Upvotes: 1
Views: 316
Reputation: 3169
I guess you have Turbolinks enabled (it makes pages load faster by only replacing the content but it's not triggering $(document).ready() )
You should bind your image links like this :
$(document).on('ready page:load', function(event) {
$('.test-popup-link').magnificPopup({ ...});
});
Or disable turbolinks
Upvotes: 1