Skip to content

MkImageSlideshow

Show source on GitHub

Node to show an Image slideshow (in autoplay mode).

Example: Regular

Jinja

{{ ["https://picsum.photos/700", "https://picsum.photos/701"] | MkImageSlideshow }}

Python

MkImageSlideshow(['https://picsum.photos/700', 'https://picsum.photos/701'])

<div style="width: 100%; padding-bottom: 25%" data-simple-slider="">
  <img src="https://picsum.photos/700">
  <img src="https://picsum.photos/701">
</div>
<div style="width: 100%; padding-bottom: 25%" data-simple-slider="">
  <img src="https://picsum.photos/700">
  <img src="https://picsum.photos/701">
</div>

Bases: MkTemplate

__init__

__init__(images: list[str], **kwargs: Any)

Parameters:

Name Type Description Default
images list[str]

A list of image URLs to use for the slideshow

required
kwargs Any

Keyword arguments passed to parent

{}
graph TD
  93860743870752["mkimageslideshow.MkImageSlideshow"]
  93860738888176["mktemplate.MkTemplate"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860738888176 --> 93860743870752
  93860744077920 --> 93860738888176
  93860744073616 --> 93860744077920
  93860744080896 --> 93860744073616
  140589822947552 --> 93860744080896
/home/runner/work/mknodes/mknodes/mknodes/basenodes/mkimageslideshow/metadata.toml
[metadata]
icon = "mdi:image-multiple"
name = "MkImageSlideshow"
group = "image"

[[resources.js]]
link = "https://rawgit.com/ruyadorno/simple-slider/master/dist/simpleslider.min.js"

[[resources.js]]
filename = "slideshow.js"
content = """
window.addEventListener('DOMContentLoaded', function () {
  simpleslider.getSlider();
})
"""

[[resources.css]]
filename = "https://unpkg.com/img-comparison-slider@7/dist/styles.css"


[examples.regular]
title = "Regular"
jinja = """
{{ ["https://picsum.photos/700", "https://picsum.photos/701"] | MkImageSlideshow }}
"""

[output.html]
template = """
<div style="width: 100%; padding-bottom: 25%" data-simple-slider="">
{% for image_url in node.images %}
  <img src="{{ image_url }}">
{% endfor %}
</div>
"""
mknodes.basenodes.mkimageslideshow.MkImageSlideshow
class MkImageSlideshow(mktemplate.MkTemplate):
    """Node to show an Image slideshow (in autoplay mode)."""

    ICON = "material/image-multiple"
    JS_FILES = [resources.JSFile(JS_URL), resources.JSText(SCRIPT, "slideshow.js")]

    def __init__(
        self,
        images: list[str],
        **kwargs: Any,
    ):
        """Constructor.

        Args:
            images: A list of image URLs to use for the slideshow
            kwargs: Keyword arguments passed to parent
        """
        super().__init__("output/html/template", **kwargs)
        self.images = images