Added collapsible element
This commit is contained in:
Родитель
d88684a1d1
Коммит
a259f99a71
|
@ -14,4 +14,13 @@ The format of this workshop is a bit different. You'll notice that you won't fin
|
|||
|
||||
We kindly ask you not to share this content outside of the challenge so as not to give it away for future participants :)
|
||||
|
||||
Enjoy and have fun!
|
||||
Enjoy and have fun!
|
||||
|
||||
{% collapsible %}
|
||||
This is hidden
|
||||
|
||||
```
|
||||
This is hidden code
|
||||
```
|
||||
|
||||
{% endcollapsible %}
|
|
@ -0,0 +1,15 @@
|
|||
module Jekyll
|
||||
class CollapsibleTagBlock < Liquid::Block
|
||||
|
||||
def render(context)
|
||||
text = super
|
||||
"<button class=\"collapsible\">Show solution</button>"
|
||||
"<div class=\"collapsible-content\">""
|
||||
#{text}
|
||||
</div>"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('collapsible', Jekyll::CollapsibleTagBlock)
|
|
@ -238,4 +238,27 @@ p + p{
|
|||
}
|
||||
.content li{
|
||||
|
||||
}
|
||||
|
||||
button.collapsible {
|
||||
background-color: #777;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
padding: 18px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
text-align: left;
|
||||
outline: none;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
button.active, button.collapsible:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
.collapsible-content {
|
||||
padding: 0 18px;
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
background-color: #f1f1f1;
|
||||
}
|
Загрузка…
Ссылка в новой задаче