Skip to content

Template functionΒ #224

@solonovamax

Description

@solonovamax

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions