Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery CarouFredSel:显示隐藏分区问题_Jquery_Html_Hide_Show_Caroufredsel - Fatal编程技术网

Jquery CarouFredSel:显示隐藏分区问题

Jquery CarouFredSel:显示隐藏分区问题,jquery,html,hide,show,caroufredsel,Jquery,Html,Hide,Show,Caroufredsel,我试图使用CarouFredSel for在一个div中显示不同的图像,该div需要在开始时隐藏并在稍后单击某个按钮时可见。但是它并没有像我预期的那样工作。但是当我在开始时将div设置为可见时,我就可以毫无问题地隐藏和显示这个div了。 因此,我正在寻找是否有人可以帮助我解决隐藏和显示卡鲁弗雷德塞尔div的问题 CSS: 显示CarouFredSel的html如下所示: 请帮助我显示和隐藏div。为了完成这项工作,我做了一些更改(使用JSFIDLE示例,教程后的链接): 删除未使用的DIV 更新

我试图使用CarouFredSel for在一个div中显示不同的图像,该div需要在开始时隐藏并在稍后单击某个按钮时可见。但是它并没有像我预期的那样工作。但是当我在开始时将div设置为可见时,我就可以毫无问题地隐藏和显示这个div了。 因此,我正在寻找是否有人可以帮助我解决隐藏和显示卡鲁弗雷德塞尔div的问题

CSS: 显示CarouFredSel的html如下所示:
请帮助我显示和隐藏div。

为了完成这项工作,我做了一些更改(使用JSFIDLE示例,教程后的链接):

  • 删除未使用的DIV
  • 更新和清理CSS样式
  • 改进的旋转木马设置:带有项目、可见和滚动
  • 在功能上转换转盘
  • 为按钮添加值
  • 添加了Placehold.it图像作为视觉示例
  • 更新了显示和隐藏功能以显示旋转木马
  • 这就是结果

    HTML JAVASCRIPT

    您需要接受答案,以便其他用户知道此帖子是正确的。上下按钮下方有一个复选标记。请检查一下;我现在明白了。你能帮我解决另一个问题吗?:当然。2件事,让你知道你可以投票支持他们,让他们更具相关性或投票反对。评论也一样。让我们来谈谈那个。
    .wrapper {
        background-color: white;
        width: 92%;
        margin: 10px auto;
        padding: 50px;
        box-shadow: 0 0 5px #999;
        display:none;
    }
    .list_carousel {
        background-color: #ccc;
        margin: 0 0 30px 30px;
        width: 95%;
    }
    .list_carousel ul {
        margin: 0;
        padding: 0;
        list-style: none;
        display: block;
    }
    .list_carousel li {
        font-size: 40px;
        color: #999;
        text-align: center;
        width: 140px;
        height: 42px;
        padding: 0;
        margin-left: 3px;
        margin-right: 3px;
        margin-top: 6px;
        margin-bottom: 6px;
        display: block;
        float: left;
    }
    .clearfix {
        float: none;
        clear: both;
    }
    .prev {
        float: left;
        margin-left: 10px;
    }
    .next {
        float: right;
        margin-right: 10px;
    }
    
    <body>
        <div class="wrapper">
            <div class="list_carousel">
                <ul id="foo2">
                    <li>
                        <img src="images/itcells.png" s alt="" />
                    </li>
                    <li>
                        <img src="images/itcells.png" alt="" />
                    </li>
                    <li>
                        <img src="images/itcells.png" alt="" />
                    </li>
                    <li>
                        <img src="images/itcells.png" alt="" />
                    </li>
                    <li>
                        <img src="images/itcells.png" alt="" />
                    </li>
                </ul>
                <div class="clearfix"></div>    <a id="prev2" class="prev" href="#">&lt;</a>
        <a id="next2" class="next"
                href="#">&gt;</a>
    
            </div>
            <br />
        </div>
        <input type="button" id="hide" />
        <input type="button" id="show" />
    </body>
    
    $(document).ready(function () {    
        $('#show').click(function () {    
            $(".wrapper").animate({
                "opacity": "show"
            }, 1000);    
        });
        $('#hide').click(function () {    
            $(".wrapper").animate({
                "opacity": "hide"
            }, 1000);    
        });    
    });
    $(function () {    
        //Scrolled by user interaction
        $('#foo2').carouFredSel({
            auto: false,
            prev: '#prev2',
            next: '#next2',
            pagination: "#pager2",
            mousewheel: true,
            swipe: {
                onMouse: true,
                onTouch: true
            }
        });    
    });         
    
    <div class="wrapper">         
          <ul id="foo2">
               <li><img src="http://placehold.it/100x100"/></li>               
               <li><img src="http://placehold.it/100x100"/></li>  
               <li><img src="http://placehold.it/100x100"/></li>  
               <li><img src="http://placehold.it/100x100"/></li>  
               <li><img src="http://placehold.it/100x100"/></li>  
               <li><img src="http://placehold.it/100x100"/></li>  
               <li><img src="http://placehold.it/100x100"/></li>  
               <li><img src="http://placehold.it/100x100"/></li>  
           </ul>
           <a id="prev2" class="prev" href="#">&lt;</a>
           <a id="next2" class="next" href="#">&gt;</a>
     </div>         
     <input type="button" id="hide" value="hide" />
     <input type="button" id="show" value="show" />    
    
    .wrapper {
        height: 100px;
        position: relative;
        background - color: white;
        margin: 10px auto;
        padding: 50px;
        box - shadow: 0 0 5px #999;display:none;}
    .clearfix {float: none;clear: both;}
    .prev {position: absolute;z-index: 9;top: 50%;left:10px;}
    .next {position: absolute;z-index: 9;top: 50%;right:10px;}
    # foo2 {margin: 0;padding: 0;}
    #foo2 li {
            display: block;
            float: left;
            height: 100px;
            text - align: center;
            width: 100px;
            color: #8cabbf;display: block;}
    # foo2 li img {border: 1px solid#dfe9ee;}
    
    $(document).ready(function () {
        $('#show').click(function () {
            $(".wrapper").animate({
                "opacity": "show"
            }, 1000);
            generateCarousel();
        });
        $('#hide').click(function () {
            $(".wrapper").animate({
                "opacity": "hide"
            }, 1000);
        });
    
        function generateCarousel() {
            //  Scrolled by user interaction
            $('#foo2').carouFredSel({
                auto: false,
                responsive: false,
                items: {
                    visible: 3,
                    width: 100
                },
                width: 600,
                prev: '#prev2',
                next: '#next2',
                pagination: "#pager2",
                swipe: {
                    onMouse: true,
                    onTouch: true
                }
            });
        }
    });