当我转到下一张幻灯片时,如何停止视频

时间:2016-01-17 00:45:30

标签: javascript jquery

网站是:ortakbilinc.com您可以在主页上看到滑块。当我点击下一张幻灯片时,视频继续播放。我该如何解决呢?我尝试了一切,但我无法处理。

网站是:ortakbilinc.com您可以在主页上看到滑块。当我点击下一张幻灯片时,视频继续播放。我该如何解决呢?我尝试了一切,但我无法处理。

 Feature Slider
-------------------------------------------------*/
if ($('.feature-slider').length) {
    $('.feature-slider').each(function() {
        var t = $(this);
        if (!t.hasClass('gallery-post-slider')) {
        var animation = t.data('sanimation');
        var speed = t.data('speed');
        var timeout = t.data('timeout');
        var easing = t.data('easing');
        var rndn = t.data('rndn');
        var rtl = false;
        var autoplay = t.data('autoplay');
        var items = t.data('items');

        var animation_new = t.data('animation_new');
        var animation_in = t.data('animation_in');
        var animation_out = t.data('animation_out');
        var margin = 10;
        var auto_height = 0;
        var thumbs_event = t.data('thumbs_event');
        if(typeof thumbs_event === 'undefined'){
            thumbs_event = 'click';
        }
        if (t.hasClass('no_spaces')) {
            margin = 5;
            auto_height = 1;
        }

        t.find('.fs-image-nav .fs-thumb').each(function(i) {
                $(this).addClass( 'item'+i );
                    if (t.hasClass('old-style')) {
                        $(this).click(function() {
                            t.find('.fslides').trigger( 'slideTo', [i, 0, true] );
                        return false;
                        });
                    }
            });

            t.find('.fs-image-nav .fs-thumb.item0').addClass( 'active' );

            var carou_items = 6;
            if ($(window).width() < 768) {
                    carou_items = 5;
            }
            if ($(window).width() < 568) {
                    carou_items = 4;
            }

            if ($(window).width() < 480 ) {
                    carou_items = 2;
            }

            if ($('body').hasClass('rtl')) {
                rtl = true;
            } 

            if (!t.hasClass('old-style')) {
                var owl = t.find('.fslides');
                var slides_count = owl.children('.fslide').length;
                if (slides_count == 1) {
                    t.addClass('fs-with-one-slide');
                }
                if (slides_count > 1) {
                owl.owlCarousel({
                    items: 1,
                    baseClass: 'mom-carousel',
                    rtl: rtl,
                    autoplay:autoplay,
                    autoplayTimeout:timeout,
                    autoplayHoverPause : false,
                    loop: true,
                    animateOut: animation_out,
                    animateIn: animation_in,
                    smartSpeed:1000,
                    //autoHeight: true,
                });
            t.find('.fslides').imagesLoaded( function() { 
                t.find('.fs-image-nav .fs-thumbs').owlCarousel({
                    items: items,
                    baseClass: 'mom-carousel',
                    rtl: rtl,
                    loop: true,
                    margin : margin,
                });
                //var thumb_height = t.find('.fs-image-nav .fs-thumbs .fs-thumb').eq(0).css('height');
                //t.find('.fs-image-nav .fs-thumbs').css('max-height', thumb_height);


                owl.on('changed.owl.carousel', function(event) {
                        var pos = $(event.target).find(".fslide").eq(event.item.index).data('i');                       
                        //console.log(pos);
                        $('.fc-nav-'+rndn+' .fs-thumb').removeClass( 'active' );
                        $('.fc-nav-'+rndn+' .fs-thumb.item'+pos).addClass( 'active' );
                        var page = Math.floor( pos / items );
                        t.find('.fs-image-nav .fs-thumbs').trigger( 'to.owl.carousel', page );
                });


                t.find('.fs-image-nav .fs-thumb').on(thumbs_event, function() {
                    var i = $(this).data('i');
                    owl.trigger('to.owl.carousel', [i]);
                });         

                t.find('.fs-image-nav .fs-prev, .fsd-prev').click(function() {
                    owl.trigger('prev.owl.carousel');
                });         

                t.find('.fs-image-nav .fs-next, .fsd-next').click(function() {
                    owl.trigger('next.owl.carousel');
                });
            });
            }
            } else {
            t.find('.fslides').carouFredSel({
                    circular: true,
                    responsive: true,
                    swipe: {
                        onTouch: true,
                        fx : 'scroll'
                    },
                    items: 1,
                    auto: {
                                             play: autoplay,
                                             duration: speed,
                                             timeoutDuration: timeout,
                                             },
                    prev: '.fc-nav-'+rndn+' .fs-prev, .fs-dnav-'+rndn+' span.fsd-prev',
                    next: '.fc-nav-'+rndn+' .fs-next, .fs-dnav-'+rndn+' span.fsd-next',
                    pagination: '.fs-nav-'+rndn,
                    scroll: {
                        fx: animation,
                                                  duration : speed,
                                                easing  : easing,
                        pauseOnHover : true,
                                            onBefore: function() {
                            var pos = $(this).triggerHandler( 'currentPosition' );
                            $('.fc-nav-'+rndn+' div').removeClass( 'active' );
                            $('.fc-nav-'+rndn+' div.item'+pos).addClass( 'active' );
                            var page = Math.floor( pos / carou_items );
                            $('.fc-nav-'+rndn+' .fs-thumbs').trigger( 'slideToPage', page );

                        },
                        onAfter: function() {
                        }

                    }
            });

            t.find('.fs-image-nav .fs-thumbs').carouFredSel({
                        auto: false,
                        circular:true,
                                        responsive: true,
                        swipe: {
                            onTouch: true
                        },
                        items: carou_items,
                        scroll: {
                            items:carou_items,
                        }
            });
        }

        } //if not the post gallery

    });

0 个答案:

没有答案