hphaavikko / dimbox

Lightweight and dependency free JavaScript library for displaying images, videos and other content on a web page.
Other
12 stars 1 forks source link

Add Explicit Constructor #5

Closed vt-cloud closed 1 year ago

vt-cloud commented 1 year ago

Hi,

I really like this project and have started to implement it in a project, however when new images are added or removed from the DOM after the initial page load, there is no documented way to re-initialise the lightbox.

This renders it unsuitable for any project that uses javascript frameworks such as Vue.js or pages with dynamic content.

It would be great to be able to call a dimbox function and have it re-scan the page for dimbox elements.

hphaavikko commented 1 year ago

Actually the init method is public but it's not documented yet, sorry! So try just dimbox.init(), it should work. If not then we'll definitely do something about it.

vt-cloud commented 1 year ago

That's the workaround I have been using, and it works perfectly in a Vue.js app.

It would just be great to have it confirmed in the docs as I don't like using undocumented functions.

hphaavikko commented 1 year ago

Will update the docs as soon as possible!

hphaavikko commented 1 year ago

Ookay, init method added to docs: https://dimboxjs.com/#methods