簡體   English   中英

帶有側菜單的引導程序 4 問題的 Sb 管理模板

[英]Sb admin template for bootstrap 4 problem with side menu

我正在將 SB admin 2 模板用於 bootstrap 4,但我遇到了側邊菜單的問題。 當網站在便攜式設備上顯示時,側邊菜單應該隱藏,而不是出現漢堡圖標。 但不是那樣工作,見下圖。 我可以檢查什么? 謝謝

正常尺寸顯示:

在此處輸入圖片說明

便攜式設備(紅色圓圈側邊菜單應隱藏):

在此處輸入圖片說明

我找到了解決方案,只需編輯 sb-admin-2.js 文件,如下所示:

代碼片段 - 之前

// Toggle the side navigation
  $("#sidebarToggle, #sidebarToggleTop").on('click', function(e) {
    $("body").toggleClass("sidebar-toggled");
    $(".sidebar").toggleClass("toggled");
    if ($(".sidebar").hasClass("toggled")) {
      $('.sidebar .collapse').collapse('hide');
    };
  });
...
  // Prevent the content wrapper from scrolling when the fixed side navigation hovered over
  $('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) {
    if ($(window).width() > 768) {
      var e0 = e.originalEvent,
        delta = e0.wheelDelta || -e0.detail;
      this.scrollTop += (delta < 0 ? 1 : -1) * 30;
      e.preventDefault();
    }
  });

代碼片段 - 之后

  // Toggle the side navigation
  $(document).on('click', '#sidebarToggle, #sidebarToggleTop', function(e) {
    $("body").toggleClass("sidebar-toggled");
    $(".sidebar").toggleClass("toggled");
    if ($(".sidebar").hasClass("toggled")) {
      $('.sidebar .collapse').collapse('hide');
    };
  });
...
  // Prevent the content wrapper from scrolling when the fixed side navigation hovered over
  $(document).on('mousewheel DOMMouseScroll wheel', 'body.fixed-nav .sidebar', function(e) {
    if ($(window).width() > 768) {
      var e0 = e.originalEvent,
        delta = e0.wheelDelta || -e0.detail;
      this.scrollTop += (delta < 0 ? 1 : -1) * 30;
      e.preventDefault();
    }
  });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM