Skip to content

Commit

Permalink
ドロワーエリアを閉じるためのdrawerCloserの実装
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Oct 13, 2019
1 parent 39a4059 commit 1c1f938
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,22 @@
}
});

function drawerCloser(selecter, checkbox){
$(selecter).click(function() {
href = $(this).attr('href');
url = location.href;
url = url.replace(/#.*$/, '');
if ((href.indexOf(url) != -1) && href.match(/#/)) {
$(checkbox).prop('checked', false);
}
})
}

//モバイルメニューをクリックしたら閉じる
$('.menu-drawer .menu-item a').click(function() {
$("#navi-menu-input").prop("checked", false);
})
drawerCloser('.menu-drawer .menu-item a', '#navi-menu-input');

//モバイルサイドバーをクリックしたら閉じる
drawerCloser('#slide-in-sidebar a', '#sidebar-menu-input');

/*
//通常のGoogleフォント読み込み
Expand Down

0 comments on commit 1c1f938

Please sign in to comment.