TypeError:jQuery(“#slider-full”)。革命不是一个功能

时间:2016-01-18 15:37:07

标签: javascript wordpress slider typeerror

当我在控制台中安装带滑块的worpdress和模板时,我遇到了这个错误: TypeError:jQuery(“#slider-full”)。革命不是一个功能。 (在'jQuery(“#slider-full”)。革命','jQuery(“#slider-full”)。革命'未定义)我现在该怎么办?

jQuery("#slider-full").revolution({
    sliderType:"standard",
    sliderLayout:"fullscreen",
    dottedOverlay:"none",
    delay:9000,
    navigation: {
        keyboardNavigation:"off",
        keyboard_direction: "horizontal",
        mouseScrollNavigation:"off",
        onHoverStop:"off",
        touch:{
            touchenabled:"on",
            swipe_threshold: 75,
            swipe_min_touches: 50,
            swipe_direction: "horizontal",
            drag_block_vertical: false
        }
        ,
        arrows: {
            style:"",
            enable:true,
            hide_onmobile:false,
            hide_onleave:true,
            hide_delay:200,
            hide_delay_mobile:1200,
            tmp:'',
            left: {
                h_align:"left",
                v_align:"center",
                h_offset:20,
                v_offset:0
            },
            right: {
                h_align:"right",
                v_align:"center",
                h_offset:20,
                v_offset:0
            }
        }
        ,
        bullets: {
            enable:true,
            hide_onmobile:true,
            hide_under:769,
            style:"",
            hide_onleave:false,
            direction:"horizontal",
            h_align:"right",
            v_align:"top",
            h_offset:60,
            v_offset:40,
            space:5,
            tmp:'<span class="tp-bullet-image"></span><span class="tp-bullet-title"></span>'
        }
    },
    responsiveLevels:[1240,1024,778,480],
    visibilityLevels:[1240,1024,778,480],
    gridwidth:[1240,1024,778,480],
    gridheight:[868,768,960,720],
    lazyType:"none",
    parallax: {
        type:"scroll",
        origo:"slidercenter",
        speed:400,
        levels:[5,10,15,20,25,30,35,40,45,46,47,48,49,50,51,55],
        type:"scroll",
    },
    shadow:0,
    spinner:"spinner2",
    stopLoop:"off",
    stopAfterLoops:-1,
    stopAtSlide:-1,
    shuffle:"off",
    autoHeight:"off",
    fullScreenAutoWidth:"off",
    fullScreenAlignForce:"off",
    fullScreenOffsetContainer: "",
    fullScreenOffset: "",
    disableProgressBar:"on",
    hideThumbsOnMobile:"off",
    hideSliderAtLimit:0,
    hideCaptionAtLimit:0,
    hideAllCaptionAtLilmit:0,
    debugMode:false,
    fallbacks: {
        simplifyAll:"off",
        nextSlideOnWindowFocus:"off",
        disableFocusListener:false,
    }
});

3 个答案:

答案 0 :(得分:1)

这意味着您的RevolutionSlider未正确包含在页面中,或者在调用它之后包含在其中。

如果已成功安装此插件并且已成功启用,则必须检入管理面板。

如果是,您可以尝试在控制台中运行jQuery("#slider-full").revolution({});以检查代码中是否包含滑块;

答案 1 :(得分:0)

执行此操作:

declare var jQuery: any;

而不是:

import $ as jquery

并使用ngAfterViewInit

最终

jQuery(this.rev_slider.nativeElement).show().revolution(RevSliderConfig)

RevSliderConfig是config的对象

rev_slider是使用ViewChild

的html中的rev滑块的ID。

答案 2 :(得分:0)

我有一个类似的问题,就我而言,这是由于两次包含jQuery引起的。

确保您没有两次包含jQuery。检查页面上包含的所有脚本,并确保它们中都没有包含jquery。

以Laravel为例,如果在Laravel安装中添加了主题,则jquery库已经位于public / js / app.js中,该主题可能随其jQuery库一起提供在某些页面上使用。只要确保将主题集成到Laravel应用中时,您就包含一个jQuery。