Jquery Revolution滑块无法停止自动播放

时间:2016-07-20 09:17:17

标签: javascript jquery revolution-slider

我正在使用Revolution滑块在我的网站上创建旋转木马。我的网站不是wordpress所以我使用Jquery版本的Revolution滑块。这是我的代码:

<div class="my-img"></div>

它创建了一个带缩略图的旋转木马,它工作正常,但我不能停止自动播放,我该怎么办?我的代码已经设置好了:

<script type="text/javascript">
                var tpj=jQuery;

                var revapi2;
                tpj(document).ready(function() {
                    if(tpj("#rev_slider_2_1").revolution == undefined){
                        revslider_showDoubleJqueryError("#rev_slider_2_1");
                    }else{
                        revapi2 = tpj("#rev_slider_2_1").show().revolution({
                            sliderType:"carousel",
                            jsFileLocation:"../libs/revolutionSlider/js/",
                            dottedOverlay:"none",
                             sliderLayout: "auto",
                            delay:9000,
                            navigation: {
                                keyboardNavigation:"off",
                                keyboard_direction: "horizontal",
                                mouseScrollNavigation:"off",
                                onHoverStop:"off",
                                arrows: {
                                    style:"",
                                    enable:true,
                                    hide_onmobile:true,
                                    hide_under:300,
                                    hide_onleave:true,
                                    hide_delay:200,
                                    hide_delay_mobile:1200,
                                    tmp:'',
                                    left: {
                                        h_align:"left",
                                        v_align:"center",
                                        h_offset:30,
                                        v_offset:0
                                    },
                                    right: {
                                        h_align:"right",
                                        v_align:"center",
                                        h_offset:30,
                                        v_offset:0
                                    }
                                }
                                ,
                                thumbnails: {
                                    style:"",
                                    enable:true,
                                    width:100,
                                    height:50,
                                    min_width:60,
                                    wrapper_padding:20,
                                    wrapper_color:"transparent",
                                    wrapper_opacity:"1",
                                    tmp:'<span class="tp-thumb-img-wrap">  <span class="tp-thumb-image"></span></span>',
                                    visibleAmount:3,
                                    hide_onmobile:true,
                                    hide_under:100,
                                    hide_onleave:false,
                                    direction:"horizontal",
                                    span:false,
                                    position:"outer-bottom",
                                    space:5,
                                    h_align:"center",
                                    v_align:"bottom",
                                    h_offset:0,
                                    v_offset:50
                                }
                            },
                            carousel: {
                                horizontal_align: "center",
                                vertical_align: "center",
                                fadeout: "off",
                                maxVisibleItems: 3,
                                infinity: "on",
                                space: 0,
                                stretch: "off"
                            },
                            viewPort: {
                                enable:true,
                                outof:"pause",
                                visible_area:"80%"
                            },
                            responsiveLevels:[1240,1024,778,480],
                            gridwidth:[1240,1024,778,480],
                            gridheight:[600,600,500,400],
                            lazyType:"none",
                            parallax: {
                                type:"mouse",
                                origo:"slidercenter",
                                speed:2000,
                                levels:[2,3,4,5,6,7,12,16,10,50],
                            },
                            shadow:0,
                            spinner:"off",
                            stopLoop:"on",
                            stopAfterLoops:0,
                            stopAtSlide:0,
                            shuffle:"off",
                            autoHeight:"on",
                            hideThumbsOnMobile:"on",
                            hideSliderAtLimit:0,
                            hideCaptionAtLimit:0,
                            hideAllCaptionAtLilmit:0,
                            debugMode:false,
                            fallbacks: {
                                simplifyAll:"off",
                                nextSlideOnWindowFocus:"off",
                                disableFocusListener:false,
                            }
                        });
                    }
                }); 
            </script>

2 个答案:

答案 0 :(得分:2)

我这样工作:

$root  = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url']    = $root;

答案 1 :(得分:0)

我这样工作:

revapi2 = tpj("#rev_slider_2_1").show().revolution({
    ...
    stopLoop: "on",
    ...
});