aboutsummaryrefslogtreecommitdiff
path: root/templates/shortcodes/imagehover.html
diff options
context:
space:
mode:
authorJieiku2022-05-31 01:45:54 -0700
committerJieiku2022-05-31 01:45:54 -0700
commitd4a052e86f33ced79b9f4d09aeee0b1c43ef1f23 (patch)
tree68b40eed2c6047850d25f5d812d596cb74a2cd96 /templates/shortcodes/imagehover.html
parent6719a3b149ec630aacec164df325de1b61221761 (diff)
downloadabridge-d4a052e86f33ced79b9f4d09aeee0b1c43ef1f23.tar.gz
abridge-d4a052e86f33ced79b9f4d09aeee0b1c43ef1f23.tar.bz2
abridge-d4a052e86f33ced79b9f4d09aeee0b1c43ef1f23.zip
Improve imghover shortcode, examples, page scores
Diffstat (limited to 'templates/shortcodes/imagehover.html')
-rw-r--r--templates/shortcodes/imagehover.html21
1 files changed, 16 insertions, 5 deletions
diff --git a/templates/shortcodes/imagehover.html b/templates/shortcodes/imagehover.html
index 68f25be..99dd4e4 100644
--- a/templates/shortcodes/imagehover.html
+++ b/templates/shortcodes/imagehover.html
@@ -8,22 +8,33 @@
{%- else %}
<div id="{{ sourcename }}">## {{ sourcename }} </div>
- <a onmouseover="document.getElementById('{{ sourcename }}').innerHTML='{{ bgname }}';" onmouseout="document.getElementById('{{ sourcename }}').innerHTML='{{ sourcename }}';" href="#"><div id="{{ sourcename }}image"> </div></a>
+ <div id="{{ sourcename }}image" alt="{{ sourcename }}"> </div>
{%- endif %}
{%- endfor %}
+{%- if w and h and p %}
+ {%- set padding = h / w * p %}
+{%- elif w and h %}
+ {%- set padding = h / w * 50 %}
+{%- else %}
+ {%- set padding = 50 %}
+{%- endif %}
+
<style>
{%- for source in sources %}
{%- set sourcename = source | split(pat=".") | first %}
{%- if not loop.first %}
#{{ sourcename | safe }}image {
- background-image: url('{{ get_url(path="/", trailing_slash=false) }}{{ page.path | safe }}{{ source | safe }}');
- width: 560px;
- height: 650px;
+ background-image: url('{{ get_url(path="/", trailing_slash=false) }}{{ page.path | safe }}{{ bg | safe }}');
+ background-size: contain;
+ background-repeat: no-repeat;
+ width: {{ p | default(value=50) }}%;
+ height: 0;
+ padding-top: {{ padding }}%;
}
#{{ sourcename | safe }}image:hover {
- background-image: url('{{ get_url(path="/", trailing_slash=false) }}{{ page.path | safe }}{{ bg | safe }}');
+ background-image: url('{{ get_url(path="/", trailing_slash=false) }}{{ page.path | safe }}{{ source | safe }}');
}
{%- endif %}
{%- endfor %}