ドロワーメニューを作ったのですが、下記の部分をクリックしてもメニューが閉じません。
.drawermenuをセレクタに入れているので.drawermenuの子孫要素どれをクリックしても閉じるはずではないでしょうか?
<div class="drawermenu drawermenu-button-animation"> <ul> <li><a class="drawermenu__item action-hover animation-hover" href="#js-about-me">ABOUTME</a></li> <li><a class="drawermenu__item action-hover animation-hover" href="#js-gallary">GALLARY</a></li> <li><a class="drawermenu__item action-hover animation-hover" href="#js-gmap">MAP</a></li> <li><a class="drawermenu__item action-hover animation-hover" href="#js-inquiry">CONTACT</a></li> <li id="js-drwar-action"><a class="drawermenu__item drawermenu__gototop action-hover animation-hover" href="#top"><i class="material-icons material-icons_large action-hover animation-hover"></i></a></li> </ul> </div>
$(function(){ // 下記をクリックすると実行される $('.modal-button-wrap, .drawermenu').on('click', function() { $('.drawermenu').toggleClass('showmenue'); }); });
回答2件
あなたの回答
tips
プレビュー