瀏覽代碼

success to get nav-tabs

kaoritokashiki 5 年之前
父節點
當前提交
7702a07d2c
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/client/js/components/PageAccessoriesModal.jsx

+ 4 - 2
src/client/js/components/PageAccessoriesModal.jsx

@@ -48,11 +48,13 @@ const PageAccessoriesModal = (props) => {
   function navSlider(menu, callback) {
   function navSlider(menu, callback) {
     const menuWidth = menu.offsetWidth;
     const menuWidth = menu.offsetWidth;
     // We only want the <li> </li> tags
     // We only want the <li> </li> tags
-    const menu1 = menu.getElementsByTagName('li');
+    const navTabs = document.querySelectorAll('li.nav-link');
+    console.log(navTabs);
+
     if (menu.length > 0) {
     if (menu.length > 0) {
       const marginLeft = [];
       const marginLeft = [];
       // Loop through nav children i.e li
       // Loop through nav children i.e li
-      [].forEach.call(menu1, (el, index) => {
+      [].forEach.call(navTabs, (el, index) => {
         // Dynamic width/margin calculation for hr
         // Dynamic width/margin calculation for hr
         const width = getPercentage(el.offsetWidth, menuWidth);
         const width = getPercentage(el.offsetWidth, menuWidth);
         let tempMarginLeft = 0;
         let tempMarginLeft = 0;