Skip to content

Commit

Permalink
Merge pull request #8 from ix-anemoff/slide_effect
Browse files Browse the repository at this point in the history
Add support for slide effect
  • Loading branch information
blueswen authored Oct 23, 2022
2 parents c14c55a + 3e7f0b7 commit 3de89d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MkDocs GLightbox
# MkDocs GLightbox

[![PyPI version](https://img.shields.io/pypi/v/mkdocs-glightbox.svg)](https://pypi.org/project/mkdocs-glightbox)
[![PyPI downloads](https://img.shields.io/pypi/dm/mkdocs-glightbox.svg)](https://pypi.org/project/mkdocs-glightbox)
Expand Down Expand Up @@ -39,11 +39,12 @@ GLightbox is a pure javascript lightbox library with mobile support.
touchNavigation: true
loop: false
effect: zoom
slide_effect: slide
width: 100%
height: auto
zoomable: true
draggable: true
skip_classes:
skip_classes:
- custom-skip-class-name
auto_caption: false
caption_position: bottom
Expand All @@ -54,6 +55,7 @@ GLightbox is a pure javascript lightbox library with mobile support.
| touchNavigation | true | Enable or disable the touch navigation (swipe). |
| loop | false | Loop slides on end. |
| effect | zoom | Name of the effect on lightbox open. (zoom, fade, none) |
| slide_effect | slide | Name of the effect on lightbox slide. (slide, zoom, fade, none) |
| width | 100% | Width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. |
| height | auto | Height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. |
| zoomable | true | Enable or disable zoomable images. |
Expand Down
3 changes: 3 additions & 0 deletions mkdocs_glightbox/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class LightboxPlugin(BasePlugin):
("loop", config_options.Type(bool, default=False)),
("effect",
config_options.Choice(("zoom", "fade", "none"), default="zoom")),
("slide_effect",
config_options.Choice(("slide", "zoom", "fade", "none"), default="slide")),
("width", config_options.Type(str, default="100%")),
("height", config_options.Type(str, default="auto")),
("zoomable", config_options.Type(bool, default=True)),
Expand Down Expand Up @@ -75,6 +77,7 @@ def on_post_page(self, output, page, config, **kwargs):
}
lb_config['openEffect'] = plugin_config.get('effect', 'zoom')
lb_config['closeEffect'] = plugin_config.get('effect', 'zoom')
lb_config['slideEffect'] = plugin_config.get('slide_effect', 'slide')
js_code.string = f"const lightbox = GLightbox({json.dumps(lb_config)});"
if config[
"theme"].name == "material" or "navigation.instant" in config[
Expand Down

0 comments on commit 3de89d9

Please sign in to comment.