简体   繁体   English

顺利移至下一个div元素

[英]Smooth move to next div element

I want to show next videos div which is hidden with smooth move. 我想显示下一个视频div,该视频隐藏起来很流畅。 Jquery .hide() or .show() function with time it does not produce expected output. 带有时间的Jquery .hide()或.show()函数不会产生预期的输出。 I want to show with smooth move. 我想以平稳的步伐表现出来。

Here is my source code: 这是我的源代码:

html: HTML:

<div class="video_wrapper">
            <div class="videos visible">
                <div class="video_content"></div>
                <div class="video_content"></div>
                <div class="video_content"></div>
                <div class="video_content"></div>
            </div>
            <div class="videos">
                <div class="video_content"></div>
                <div class="video_content"></div>
                <div class="video_content"></div>
                <div class="video_content"></div>
            </div>
            <div class="videos">
                <div class="video_content"></div>
                <div class="video_content"></div>
                <div class="video_content"></div>
                <div class="video_content"></div>
            </div>
        </div>
        <div class="controls">
        <div class="pre_element">&lang;</div>
        <div class="next_element">&rang;</div>
    </div>

Jquery: jQuery的:

 $(".next_element").click(function() {
            //Show previous button
            $('.pre_element').show();
            //Find the element that's currently showing
            $showing = $('.video_wrapper .videos.visible').first();
            //Find the next element
            $next = $showing.next();
            //Change which div is showing
            $showing.removeClass("visible").hide();
            $next.addClass("visible").show(200);
            //If there's no more elements, hide the NEXT button

If You want to slide horizontally, than you should use horizon-swiper . 如果要水平滑动,则应使用Horizo​​ntal-swiper
Or You can use Hide with slide effect (Checkout answer here ) from JQuery UI. 或者,您可以 JQuery UI中使用具有幻灯片效果的隐藏( 此处为Checkout答案)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM