-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: add 2 interactive image shortcodes
- Loading branch information
Showing
8 changed files
with
150 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.image-hover-container { | ||
position: relative; | ||
display: inline-block; | ||
width: 100%; | ||
|
||
.image-default { | ||
display: block; | ||
} | ||
|
||
.image-hovered { | ||
display: none; | ||
} | ||
|
||
&:hover .image-hovered { | ||
display: block; | ||
} | ||
|
||
&:hover .image-default { | ||
display: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.image-toggled { | ||
visibility: hidden; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
} | ||
|
||
.image-toggler-toggle { | ||
display: none; | ||
} | ||
|
||
.image-toggler-toggle:checked ~ .image-label .image-toggled { | ||
visibility: visible; | ||
position: static; | ||
} | ||
|
||
.image-toggler-toggle:checked ~ .image-label .image-default { | ||
visibility: hidden; | ||
position: absolute; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{%- set default_meta = get_image_metadata(path=default_src, allow_missing=true) -%} | ||
{%- set hovered_meta = get_image_metadata(path=hovered_src, allow_missing=true) -%} | ||
|
||
<div class="image-hover-container {% if full_width | default(value=false) %}full-width{% endif %}"> | ||
<div class="image-default"> | ||
<img src="{{ get_url(path=default_src) }}" alt="{{ default_alt }}" | ||
width="{{ default_meta.width }}" height="{{ default_meta.height }}"> | ||
</div> | ||
<div class="image-hovered"> | ||
<img src="{{ get_url(path=hovered_src) }}" alt="{{ hovered_alt }}" | ||
width="{{ hovered_meta.width }}" height="{{ hovered_meta.height }}"> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{%- set random_id = get_random(end=100000) -%} | ||
|
||
{% set default_meta = get_image_metadata(path=default_src, allow_missing=true) %} | ||
{% set toggled_meta = get_image_metadata(path=toggled_src, allow_missing=true) %} | ||
|
||
<div class="image-toggler-container {% if full_width | default(value=false) %}full-width{% endif %}"> | ||
<input type="checkbox" id="toggle-img-{{ random_id }}" class="image-toggler-toggle"> | ||
<label for="toggle-img-{{ random_id }}" class="image-label"> | ||
<div class="image-default"> | ||
<img src="{{ get_url(path=default_src) }}" alt="{{ default_alt }}" | ||
width="{{ default_meta.width }}" height="{{ default_meta.height }}"> | ||
</div> | ||
<div class="image-toggled"> | ||
<img src="{{ get_url(path=toggled_src) }}" alt="{{ toggled_alt }}" | ||
width="{{ toggled_meta.width }}" height="{{ toggled_meta.height }}"> | ||
</div> | ||
</label> | ||
</div> |