Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No scrolling after closing lightbox (blueimp)

I built my own website and wanted to add different galleries, so I tried blueimp. It works perfectly, but when I'm closing the lightbox, I'm not able to scroll on my page anymore. Can somebody please help me?

Here's a little code snippet:

<div id="artworks">
    <a href="gallery/artworks/test1.jpg" title="test1" data-gallery="#blueimp-gallery-artworks" class="btn btn-primary btn-lg" role="button">TAKE A LOOK</a>
    <a href="gallery/artworks/test2.jpg" title="test2" data-gallery="#blueimp-gallery-artworks"></a>
</div>

<!-- blueimp Gallery lightbox -->
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>

<!-- scripts -->
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.blueimp-gallery.min.js"></script>
<script>
document.getElementById('artworks').onclick = function (event) {
    event = event || window.event;
    var target = event.target || event.srcElement,
        link = target.src ? target.parentNode : target,
        options = {index: link, event: event},
        links = this.getElementsByTagName('a');
    blueimp.Gallery(links, options);
};
</script>
like image 270
zoesch Avatar asked Apr 25 '15 15:04

zoesch


2 Answers

In the variable options declared hidePageScrollbars: false (default is true), this works for me. See the folowing code:

<script>
    document.getElementById('artworks').onclick = function (event) {
    event = event || window.event;
    var target = event.target || event.srcElement,
       link = target.src ? target.parentNode : target,
       options = {index: link, event: event, hidePageScrollbars: false},
       links = this.getElementsByTagName('a');
    blueimp.Gallery(links, options);
    };
</script>
like image 184
rianmz Avatar answered Nov 11 '22 14:11

rianmz


In my case I have accidentally added multiple bluimp scripts. I removed the other and keep just one js file for the plugin then it fixed.

like image 31
user4976254 Avatar answered Nov 11 '22 12:11

user4976254