mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-17 09:16:10 +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({
|
return Object.freeze({
|
||||||
show: show,
|
show: show,
|
||||||
hide: hide
|
hide: hide,
|
||||||
|
toggle: toggle
|
||||||
})
|
})
|
||||||
})();
|
})();
|
||||||
})(window);
|
})(window);
|
||||||
|
|
|
@ -64,19 +64,22 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<!-- arrow for opening/closing -->
|
<!-- 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"
|
<span id="sideBarLeft"
|
||||||
class="fas fa-chevron-left"
|
class="fas fa-chevron-left"
|
||||||
aria-hidden="true"
|
aria-hidden="false"
|
||||||
onclick="SideBarToggle.hide()"
|
|
||||||
></span>
|
></span>
|
||||||
<span id="sideBarRight"
|
<span id="sideBarRight"
|
||||||
class="fas fa-chevron-right"
|
class="fas fa-chevron-right"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
onclick="SideBarToggle.show()"
|
|
||||||
style="display:none;"
|
style="display:none;"
|
||||||
></span>
|
></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue