use JS to show/hide subrecipes
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
f07860b1d4
commit
5f19345653
4 changed files with 22 additions and 3 deletions
|
@ -5,6 +5,6 @@
|
||||||
<{{tag}}>Ingredients</{{tag}}>
|
<{{tag}}>Ingredients</{{tag}}>
|
||||||
<ul>
|
<ul>
|
||||||
{% for item in page.ingredients -%}
|
{% for item in page.ingredients -%}
|
||||||
<li>{{ item[0] }} {%- if item[2] %} {{ item[2] }} of {% endif %} {{ item[1] }}</li>
|
<li>{{ item[0] }} {%- if item[2] %} {{ item[2] }} of {% endif -%} {{ item[1] }}</li>
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel='stylesheet' href='/style.css'>
|
<link rel='stylesheet' href='/style.css'>
|
||||||
|
<script async src='/script.js'></script>
|
||||||
<title>{{ page.title }}</title>
|
<title>{{ page.title }}</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,9 @@ layout: default
|
||||||
<h2> Subrecipes </h2>
|
<h2> Subrecipes </h2>
|
||||||
{% for subrecipe in site.subrecipes -%}
|
{% for subrecipe in site.subrecipes -%}
|
||||||
{%- if subrecipe.parents contains id -%}
|
{%- if subrecipe.parents contains id -%}
|
||||||
<div class='subrecipe' id='sr-{{ subrecipe.name | downcase | url_encode }}'>
|
{%- assign srid = "sr-" | append: subrecipe.name | downcase | url_encode -%}
|
||||||
<h3>{{ subrecipe.name }}</h3>
|
<div class='subrecipe' id='{{ srid }}'>
|
||||||
|
<div class='subrecipe-heading'><h3>{{ subrecipe.name }}</h3><span class='subrecipe-toggle show' onclick="subrecipe_toggle('{{ srid }}');"></span></div>
|
||||||
<div class='subrecipe-output'>
|
<div class='subrecipe-output'>
|
||||||
{{ subrecipe.output }}
|
{{ subrecipe.output }}
|
||||||
</div>
|
</div>
|
||||||
|
|
17
style.css
17
style.css
|
@ -24,6 +24,23 @@ body div {
|
||||||
height: min-content;
|
height: min-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subrecipe-heading h3 {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subrecipe-toggle {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
.subrecipe-toggle::after {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.subrecipe .subrecipe-toggle::after {
|
||||||
|
content: "Show";
|
||||||
|
}
|
||||||
|
.subrecipe.open .subrecipe-toggle::after {
|
||||||
|
content: "Hide";
|
||||||
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
list-style-type: "- ";
|
list-style-type: "- ";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue