The problem
Currently, you can provide a template via an html <template> element.
However, this is not sufficient for all cases.
For example, if I wanted to recreate something similar to wikipedia:
https://en.wikipedia.org/wiki/Main_Page#/media/File:Eugene_Parker_2019.jpg
On the bottom, Wikipedia shows some information about the image, for example: description, copyright, etc.
Solution
Obviously, it is out of scope for this library to handle all possible kinds of metadata.
The way I think it should be done is that the library can offer the ability to provide a function which returns an HTMLElement for a provided image.
The function signature should likely be something along the lines of
function(src: string, target: HTMLElement): HTMLElement | Promise<HTMLElement>
where src is the image (from data-zoom-src), and target is the target image element. (which users can then to get data attributes from, get an id from to make an http request, etc.)
this function would get passed as the template parameter.
The problem
Currently, you can provide a template via an html
<template>element.However, this is not sufficient for all cases.
For example, if I wanted to recreate something similar to wikipedia:
https://en.wikipedia.org/wiki/Main_Page#/media/File:Eugene_Parker_2019.jpg
On the bottom, Wikipedia shows some information about the image, for example: description, copyright, etc.
Solution
Obviously, it is out of scope for this library to handle all possible kinds of metadata.
The way I think it should be done is that the library can offer the ability to provide a function which returns an
HTMLElementfor a provided image.The function signature should likely be something along the lines of
where
srcis the image (fromdata-zoom-src), andtargetis the target image element. (which users can then to get data attributes from, get an id from to make an http request, etc.)this function would get passed as the
templateparameter.