简体   繁体   English

我的滑块仅显示第1和第3个滑块,但不显示表格的第2和第4个滑块

[英]My slider only shows 1st and 3rd slider but not the 2nd and 4th slider for table

I made a simple slider which works fine for normal table, but when I try to use that slider for my customised bootstrap table only 1st, 3rd slider is showing up but not the 2nd and 4th. 我制作了一个简单的滑块,可以正常使用普通表,但是当我尝试将该滑块用于我的自定义引导表时,只有第1个,第3个滑块显示但不是第2个和第4个。

var slideIndex = 1;
showDivs(slideIndex);

function plusDivs(n) {
 showDivs(slideIndex += n);
}

function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
console.log("len "+x.length);
if (n > x.length) {

  slideIndex = 1;
}    
if (n < 1) {
   slideIndex = x.length;
 }
for (i = 0; i < x.length; i++) {
  x[i].style.display = "none";  
}
 x[slideIndex-1].style.display = "block";  
 }

This is the html code: 这是html代码:

<div class="w3-content w3-display-container">
    <div class="mySlides">

<div class="row">
    <div class="col-md-6">
        <div class="panel panel-primary">
            <div class="panel-body">
                <h4 class="m-b-30 m-t-0">Q'3</h4>
                <div class="row">
                    <div class="col-xs-12">
                        <table class="table table-hover">
                            <thead>
                                    <tr>
                                            <th>Time Period</th>
                                            <th>Jan</th>
                                            <th>Feb</th>
                                            <th>Mar</th>
                                            <th>Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td># of Project<br>Completed</td>
                                            <td>20</td>                                                                </td>
                                            <td>17</td>
                                            <td>15</td>
                                            <td>52</td>
                                        </tr>
                                        <tr>
                                            <td>Total <br>Phases</td>
                                            <td>14</td>
                                            <td>29</td>
                                            <td>23</td>
                                            <td>74</td>
                                        </tr>
                                        <tr>
                                            <td># Feedback <br>Received</td>
                                            <td>12</td>
                                            <td>7</td>
                                            <td>2</td>
                                            <td>21</td>
                                        </tr>
                                        <tr>
                                            <td>Adiva <br>Incurred (hrs)</td>
                                            <td>927</td>
                                            <td>965</td>
                                            <td>636</td>
                                            <td>2528</td>
                                        </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>

    </div>

 <button class="w3-button w3-black w3-display-left" 
 onclick="plusDivs(-1)">&#10094;</button>
  <button class="w3-button w3-black w3-display-right" 
   onclick="plusDivs(1)">&#10095;</button>
  </div>

I have given only the one input file. 我只给了一个输入文件。 More 3 similar table will be added, But after adding this to my class, only 1st and 3rd one is showing. 将添加更多3个类似的表格,但在将其添加到我的班级后,只显示第1个和第3个。 Another object like image, normal text sliding is working fine, but only this table shows the problem. 另一个像图像,普通文本滑动的对象工作正常,但只有这个表显示问题。 And I am using only core JS for sliding, but my main file has jquery , but there are for another purposes 我只使用核心JS进行滑动,但我的主文件有jquery ,但还有其他用途

I see that you have wrong html markup. 我看到你有错误的HTML标记。 There is one superfluous </td> which broke valid html. 有一个多余的</td>打破了有效的HTML。

I've figured it out. 我已经明白了。 It was a div tag problem. 这是一个div标签问题。 Div wasnt closed properly. Div没有正确关闭。 Now it works fine 现在它工作正常

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jQuery图像滑块首先加载第三和第四图像的合并,而不是第一 - jQuery image slider first loading amalgimation of 3rd and 4th images instead of 1st 给定一个数字数组,返回一个数字数组,其中包含第一个数字,接下来 2 个数字的总和(2nd, 3rd),接下来 3 个数字的总和(4th,5th,6th) - Given an array of numbers, return an array of numbers which contains 1st number, Sum of next 2 numbers (2nd, 3rd), Sum of next 3 numbers(4th,5th,6th) 如何在选项标签 select 下拉列表 1st 2nd 3rd 4th 5th 中添加上标。 1ST 我想要 S 大写字母,但我试过 s 将转换为小写 - How to add superscript in option tag select dropdown 1st 2nd 3rd 4th 5th. 1ST I want S captial letters but i tried s will converted to small case 选择THIS元素的第1个第2个和第3个子元素 - Select 1st 2nd and 3rd child element of THIS element 如果array包含2个相同的对象,则将第二个(或第3个,第4个)对象的值突变 - If array includes 2 objects which are the same, then mutate the 2nd (or 3rd, 4th) object's values jQuery如何获取第二和第三TD内容取决于第四点击 - JQuery how to fetch 2nd and 3rd TD content depend on 4th td click 删除查询第一次未触发,第二次或第三次触发 - Delete query didn't fired on 1st time,it fired after 2nd or 3rd time 隐藏在第一和第二选择列表中选择的第三选择列表的选项 - Hide option of 3rd select list which are selected in 1st and 2nd select list Puppeteer 打开下拉菜单,然后单击 [1st 2nd 3rd…] 选项 - Puppeteer Open Dropdown Menu and then click on [1st 2nd 3rd…] option 隐藏1、3、4、6、7、9、10、12 div容器 - Hide 1st, 3rd, 4th, 6th, 7th, 9th, 10th, 12th div container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM