Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    No, this is not possible yet.

    But I may consider adding a hook for custom functions in future updates. What exactly is your use case?

    Thread Starter jasperkastilan

    (@jasperkastilan)

    Thank you for your quick response.
    I’d like to hide/show the scollbar of the body.

    Plugin Author Arno Welzel

    (@awelzel)

    Well – this might be a useful feature of the plugin itself.

    Any pull requests are welcome: https://github.com/arnowelzel/periodical/

    However if you send me the code for this I could also add this manually.

    Thread Starter jasperkastilan

    (@jasperkastilan)

    Oh great. Nice to hear. I’d realy looking forward to this feature.
    I wrote those two functions.

    function hideScrollbar() {
        const scrollbarWidth = window.innerWidth - document.body.offsetWidth;
        document.body.style.paddingRight = scrollbarWidth + "px";
        document.body.style.overflow = "hidden";
        var list = document.getElementsByClassName('list-group');    
    }
    function showScrollbar() {
        document.body.style.paddingRight = 0;
        document.body.style.overflow = "auto";    
    }

    To call them I have edited the photoswipe.js . I call hideScrollbar() in the ‘if(_options.mainClass)’ -clause (line: 920) and showscrollbar() in the ‘destroy: function()’. That’s probably not the most elegant solution, but for now it works.
    Anyway a hook for custom functions would be nice either.
    I consider that the topic can be closed.

    Plugin Author Arno Welzel

    (@awelzel)

    Release 3.1.2 contains a slightly modified version of your suggestion which also makes use of the internal event system of PhotoSwipe.

    Are more generic hook might be added in the future: https://github.com/arnowelzel/lightbox-photoswipe/issues/63

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘call a javascript function’ is closed to new replies.