mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-02 05:02:18 +08:00
Improve toggle
This commit is contained in:
parent
f972676f8d
commit
c9f3de9f27
2 changed files with 21 additions and 6 deletions
|
@ -27,9 +27,21 @@
|
|||
});
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
var btn = $('#sideBarButton');
|
||||
if (btn.attr('data-shown')) {
|
||||
btn.attr('data-shown', false);
|
||||
hide();
|
||||
} else {
|
||||
btn.attr('data-shown', true);
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
return Object.freeze({
|
||||
show: show,
|
||||
hide: hide
|
||||
hide: hide,
|
||||
toggle: toggle
|
||||
})
|
||||
})();
|
||||
})(window);
|
||||
|
|
|
@ -64,19 +64,22 @@
|
|||
<% end %>
|
||||
</li>
|
||||
<!-- arrow for opening/closing -->
|
||||
<li class="text-center" style="padding: 5px;">
|
||||
<li class="text-center"
|
||||
style="padding: 5px;"
|
||||
id="sideBarButton"
|
||||
data-shown="true"
|
||||
onclick="SideBarToggle.toggle()"
|
||||
>
|
||||
<span id="sideBarLeft"
|
||||
class="fas fa-chevron-left"
|
||||
aria-hidden="true"
|
||||
onclick="SideBarToggle.hide()"
|
||||
aria-hidden="false"
|
||||
></span>
|
||||
<span id="sideBarRight"
|
||||
class="fas fa-chevron-right"
|
||||
aria-hidden="true"
|
||||
onclick="SideBarToggle.show()"
|
||||
style="display:none;"
|
||||
></span>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue