跳转到自定义猫头鹰轮播中的页面

时间:2017-08-26 06:09:24

标签: jquery css owl-carousel

我有一个模板,我有一个猫头鹰旋转木马。

旋转木马工作正常。

它的餐厅菜单 - 我创建了“跳转到页面”的链接,如“饮料”,“蛋糕”,“沙拉”......

但我不能跳到页面...我尝试了很多选项 - 但没有一个正常工作..

我找到了这个JS代码:

carousel: function(){

    if( !$().owlCarousel ) {
        console.log('carousel: Owl Carousel not Defined.');
        return true;
    }

    var $carousel = $('.carousel-widget:not(.customjs)');
    if( $carousel.length < 1 ){ return true; }

    $carousel.each( function(){
        var element = $(this),
            elementItems = element.attr('data-items'),
            elementItemsLg = element.attr('data-items-lg'),
            elementItemsMd = element.attr('data-items-md'),
            elementItemsSm = element.attr('data-items-sm'),
            elementItemsXs = element.attr('data-items-xs'),
            elementItemsXxs = element.attr('data-items-xxs'),
            elementLoop = element.attr('data-loop'),
            elementAutoPlay = element.attr('data-autoplay'),
            elementSpeed = element.attr('data-speed'),
            elementAnimateIn = element.attr('data-animate-in'),
            elementAnimateOut = element.attr('data-animate-out'),
            elementNav = element.attr('data-nav'),
            elementPagi = element.attr('data-pagi'),
            elementMargin = element.attr('data-margin'),
            elementStage = element.attr('data-stage-padding'),
            elementMerge = element.attr('data-merge'),
            elementStart = element.attr('data-start'),
            elementRewind = element.attr('data-rewind'),
            elementSlideBy = element.attr('data-slideby'),
            elementCenter = element.attr('data-center'),
            elementLazy = element.attr('data-lazyload'),
            elementVideo = element.attr('data-video'),
            elementRTL = element.attr('data-rtl');

        if( !elementItems ) { elementItems = 4; }
        if( !elementItemsLg ) { elementItemsLg = Number(elementItems); }
        if( !elementItemsMd ) { elementItemsMd = Number(elementItemsLg); }
        if( !elementItemsSm ) { elementItemsSm = Number(elementItemsMd); }
        if( !elementItemsXs ) { elementItemsXs = Number(elementItemsSm); }
        if( !elementItemsXxs ) { elementItemsXxs = Number(elementItemsXs); }
        if( !elementSpeed ) { elementSpeed = 250; }
        if( !elementMargin ) { elementMargin = 20; }
        if( !elementStage ) { elementStage = 0; }
        if( !elementStart ) { elementStart = 0; }

        if( !elementSlideBy ) { elementSlideBy = 1; }
        if( elementSlideBy == 'page' ) {
            elementSlideBy = 'page';
        } else {
            elementSlideBy = Number(elementSlideBy);
        }

        if( elementLoop == 'true' ){ elementLoop = true; } else { elementLoop = false; }
        if( !elementAutoPlay ){
            elementAutoPlay = false;
            var elementAutoPlayTime = 0;
        } else {
            var elementAutoPlayTime = Number(elementAutoPlay);
            elementAutoPlay = true;
        }
        if( !elementAnimateIn ) { elementAnimateIn = false; }
        if( !elementAnimateOut ) { elementAnimateOut = false; }
        if( elementNav == 'false' ){ elementNav = false; } else { elementNav = true; }
        if( elementPagi == 'false' ){ elementPagi = false; } else { elementPagi = true; }
        if( elementRewind == 'true' ){ elementRewind = true; } else { elementRewind = false; }
        if( elementMerge == 'true' ){ elementMerge = true; } else { elementMerge = false; }
        if( elementCenter == 'true' ){ elementCenter = true; } else { elementCenter = false; }
        if( elementLazy == 'true' ){ elementLazy = true; } else { elementLazy = false; }
        if( elementVideo == 'true' ){ elementVideo = true; } else { elementVideo = false; }
        if( elementRTL == 'true' || $body.hasClass('rtl') ){ elementRTL = true; } else { elementRTL = false; }

        element.owlCarousel({
            margin: Number(elementMargin),
            loop: elementLoop,
            stagePadding: Number(elementStage),
            merge: elementMerge,
            startPosition: Number(elementStart),
            rewind: elementRewind,
            slideBy: elementSlideBy,
            center: elementCenter,
            lazyLoad: elementLazy,
            nav: elementNav,
            navText: ['<i class="icon-angle-left"></i>','<i class="icon-angle-right"></i>'],
            autoplay: elementAutoPlay,
            autoplayTimeout: elementAutoPlayTime,
            autoplayHoverPause: true,
            dots: elementPagi,
            smartSpeed: Number(elementSpeed),
            fluidSpeed: Number(elementSpeed),
            video: elementVideo,
            animateIn: elementAnimateIn,
            animateOut: elementAnimateOut,
            rtl: elementRTL,
            responsive:{
                0:{ items:Number(elementItemsXxs) },
                480:{ items:Number(elementItemsXs) },
                768:{ items:Number(elementItemsSm) },
                992:{ items:Number(elementItemsMd) },
                1200:{ items:Number(elementItemsLg) }
            },
            onInitialized: function(){
                SEMICOLON.slider.owlCaptionInit();
                SEMICOLON.slider.sliderParallaxDimensions();
                SEMICOLON.initialize.lightbox();
            }
        });
    });
},

我试试:

$('#oc-menu').owlCarousel({
    loop:true,
    margin:10,
    nav:true,
    responsive:{
        0:{
            items:1
        },
        600:{
            items:3
        },
        1000:{
            items:5
        }
    }
}) 

$('.btnJump').click(function(){
    $('#oc-menu').trigger('to.owl.carousel', 3)
  });

和其他人......但没有一个对我有用。

任何想法?

编辑:找到版本:/ * Owl Carousel 2.0.0.beta.3 * /

0 个答案:

没有答案