Fix the navigation menu not opening on touch (#690)
* Fix iOS menu issue * Fix burger menu iOS trigger * Modify the menu script to work on iOS too * Update main.rs * Update main.rs * Update main.rs
This commit is contained in:
parent
df6f398efc
commit
c66ef5f85d
@ -69,19 +69,19 @@ fn main() {
|
||||
.ok();
|
||||
}
|
||||
|
||||
/// Toggle menu on mobile device
|
||||
/// Toggle menu on mobile devices
|
||||
///
|
||||
/// It should normally be working fine even without this code
|
||||
/// But :focus-within is not yet supported by Webkit/Blink
|
||||
fn menu() {
|
||||
if let Some(button) = document().get_element_by_id("menu") {
|
||||
if let Some(menu) = document().get_element_by_id("content") {
|
||||
button.add_event_listener(|_: ClickEvent| {
|
||||
button.add_event_listener(|_: TouchEnd| {
|
||||
document()
|
||||
.get_element_by_id("menu")
|
||||
.map(|menu| menu.class_list().add("show"));
|
||||
});
|
||||
menu.add_event_listener(|_: ClickEvent| {
|
||||
menu.add_event_listener(|_: TouchEnd| {
|
||||
document()
|
||||
.get_element_by_id("menu")
|
||||
.map(|menu| menu.class_list().remove("show"));
|
||||
|
Loading…
Reference in New Issue
Block a user