getgrav / grav-plugin-lightslider

Grav LightSlider Plugin
https://getgrav.org
MIT License
14 stars 15 forks source link

lightslider only works after reloading the page #44

Open TristanKonrad opened 3 years ago

TristanKonrad commented 3 years ago

Hello,

I installed the lightslider plugin on my Grav page and I have to reload the page everytime for the lightslider to show up. I am fairly new to coding and took the page over from our coder who left the company.

Please tell me if you need additional information.

Kind regards Tristan

foersterp commented 2 years ago

Hello,

I have the same problem. In Chromium (96.0.4664.45) I have to reload the page for the lightslider to show up. In Firefox (94.0) it shows up sometimes and sometimes it doesn't.

The Chromium console prints the following error: chromium

And the Firefox console shows this error: firefox

I'm new to coding and Grav so I don't know how to solve this problem. Maybe somebody knows.

But is the project actually under active development?

Thanks!

foersterp commented 2 years ago

I found a fix for that problem here: https://discourse.getgrav.org/t/how-to-install-a-slider-between-two-sections-of-an-existing-modular-page/18962

I edited /user/lightslider/templates/modular/lightslider.html.twig and added the code from the forum post which is the following:

<script type="text/javascript"> document.addEventListener("DOMContentLoaded", () => { --- insert original javascript here --- }); </script>

I don't know if this is the correct file to edit but it worked for me.

I hope that helps.