2013-10-07 22 views
0

我最近以this結束了關閉畫布導航。如果你在他們的演示中看到他們做了什麼,如果我們想要關閉側邊欄,你必須點擊正文內的任何地方,並且邊欄中的一個類已被移除以滑出側邊欄。offcanvas導航onclick的側欄過渡刪除類

我想要的是同樣的效果是在單擊邊欄內的關閉按鈕時必須滑出邊欄。如何實現這一目標?

這是他們用來刪除類的代碼。

var container = document.getElementById('st-container'), 
     buttons = Array.prototype.slice.call(document.querySelectorAll('#st-trigger-effects > button')), 
     // event type (if mobile use touch events) 
     eventtype = mobilecheck() ? 'touchstart' : 'click', 
     resetMenu = function() { 
      classie.remove(container, 'st-menu-open'); 
     }, 
     bodyClickFn = function(evt) { 
      if(!hasParentClass(evt.target, 'st-menu')) { 
       resetMenu(); 
       document.removeEventListener(eventtype, bodyClickFn); 
      } 
     }; 

感謝

+0

'從側邊欄類已被刪除滑出sidebar'。對?然後刪除該關閉按鈕單擊事件類 – super

+0

是的,我知道但不知道該怎麼做。 – Kumaresh

回答

0

我覺得你熟悉的jQuery:

$(document).ready(function() { 
     $('#Your-close button-id').on('click', function() { 
      $(this).removeClass('st-menu-open'); 
     }); 
    });