MkImageCompare
:fa-brands-github: Show source on GitHub
Node to show an Image comparison (using a slider).¶
Example: Regular¶
Bases: MkTemplate
__init__
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
before_image
|
str
|
Image shown with slider to the right |
required |
after_image
|
str
|
Image shown with slider to the left |
required |
kwargs
|
Any
|
Keyword arguments passed to parent |
{}
|
| Name | Children | Inherits |
|---|---|---|
| MkTemplate mknodes.templatenodes.mktemplate Node representing a jinja template. |
graph TD
800882708["mkimagecompare.MkImageCompare"]
1289759389["mktemplate.MkTemplate"]
3160803176["rendercache.TemplateRenderMixin"]
2751680898["builtins.object"]
835538629["mkcontainer.MkContainer"]
1956333208["mkcontainer.MkContainerBase"]
1359323199["mknode.MkNode"]
1289759389 --> 800882708
3160803176 --> 1289759389
2751680898 --> 3160803176
835538629 --> 1289759389
1956333208 --> 835538629
1359323199 --> 1956333208
2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/mknodes/basenodes/mkimagecompare/metadata.toml
[metadata]
icon = "mdi:image-off"
name = "MkImageCompare"
group = "image"
[[resources.js]]
link = "https://unpkg.com/img-comparison-slider@7/dist/index.js"
defer = true
[[resources.css]]
filename = "https://unpkg.com/img-comparison-slider@7/dist/styles.css"
[examples.regular]
title = "Regular"
jinja = """
{{ "https://picsum.photos/700" | MkImageCompare(after_image="https://picsum.photos/701") }}
"""
[output.html]
template = """
<img-comparison-slider>
<img src="{{ node.before_image }}" slot="first">
<img src="{{ node.after_image }}" slot="second">
</img-comparison-slider>
"""
Page info
Code for this page
Resources
Resources(css=[],
markdown_extensions={'admonition': {},
'pymdownx.details': {},
'pymdownx.highlight': {'anchor_linenums': True,
'line_spans': '__span',
'pygments_lang_class': True},
'pymdownx.superfences': {'custom_fences': [{'class': 'mermaid',
'format': <function fence_code_format at 0x703933662e50>,
'name': 'mermaid'}]},
'pymdownx.tabbed': {},
'tables': {}},
plugins=[Plugin('mkdocstrings')],
js=[],
assets=[],
packages=[])