javascript - 将导航选项卡更改为轮播

标签 javascript jquery html css twitter-bootstrap

我们有一个导航选项卡,每个选项卡都有一个图像网格 .

随着屏幕尺寸的变化,我们希望能够删除除第一个选项卡之外的所有选项卡。并在轮播 View 中的第一个选项卡中显示图像。

enter image description here

我尝试使用 addClass 和 removeClass 选项,但它变得 super 复杂而且效率不高。我觉得应该有一种更简单的方法来管理它。

最佳答案

这里有一些可能对你有帮助的代码:

if (document.documentElement.clientWidth < 320) {
    function mySlider(){
        // Your slider code here
    }
    mySLider();
}
ul li { width:33%; border-right:1px solid red;border-bottom:1px solid red; background:blue; color: white; height:150px; text-align:center; float:left; display:inline-block;}

ul li:nth-child(3n){
border-right:0;
}

@media (max-width:320px){
.slider{width:320px;}
.sliderOverflow{
    width:500000px;
    overflow:hidden;
}
ul li {
    width:320px;
} 
}
<div class="slider">
    <div class="sliderOverflow">
    <ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
</ul>
        </div>
</div>

关于javascript - 将导航选项卡更改为轮播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31363313/

相关文章:

javascript - 在 fullcalendar eventDrop 中获取完整日期

html - 光标位置在标签后没有到达正确的位置

javascript - Tablesorter:对捷克字母表进行排序

javascript - 如何对 $(xml).children() 进行排序?

jquery - 从 Controller 获取标记以使用 gmaps4rails 刷新 map

html - Bootstrap 中带有页眉和页脚的垂直居中

javascript - 显示来自给定 url 的图像

javascript - 使用 AJAX 源时,Typeahead 会使用 'undefined' 填充下拉列表

javascript - 单击视频时,如何使用 Javascript 切换多个视频的播放/暂停?

javascript - 创建 typescript 类型 "one of interfaces"