Hi another newbie question, i am not quite sure how to integrate an external javascript in the best way. In my case I have:
installed, like so
npm install fslightbox
Now it is in the directory /node_modules/fslightbox/index.js
(hooray). I created /assets/custom.js
with the import, so it gets hopefully loaded:
require('fslightbox');
and mount the module like so:
[[mounts]]
source = "node_modules/fslightbox"
target = "assets"
But I can’t access the Module in a basic Shortcode. The simple examples from here…
<a data-fslightbox href="https://i.imgur.com/fsyrScY.jpg">
<img src="https://i.imgur.com/fsyrScY.jpg" alt="Image">
</a>
and
<script type="text/javascript">
(function() {
console.log("############# FSLIGHTBOX IS HERE");
var lightbox = new FsLightbox();
lightbox.props.sources = ["https://i.imgur.com/fsyrScY.jpg", "https://i.imgur.com/fsyrScY.jpg"];
lightbox.open();
});
</script>
doesnt have any effect.
I think I’m missing something here again.Any advice is welcome