1

我正在使用BxSlider,它是我网页上的一个 Jquery 插件。我将滑动模式设置为“垂直”,但默认滑动方向是从下到上移动,但我想将其更改为从上到下移动。但我想不通。任何建议将不胜感激

4

3 回答 3

1

您可以使用定位设置滑块箭头的位置。例如,我们将滑块“箭头”定位设置为绝对,上一个箭头顶部,下一个箭头底部。

于 2014-03-08T01:26:07.550 回答
0

为此,您必须更改core codeplugin

在插件中

var setSlidePosition = function(){
    // if last slide, not infinite loop, and number of children is larger than specified maxSlides
    if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){
        if (slider.settings.mode == 'horizontal'){
            // get the last child's position
            var lastChild = slider.children.last();
            var position = lastChild.position();
            // set the left position
            setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.width())), 'reset', 0);
        }else if(slider.settings.mode == 'vertical'){
            // get the last showing index's position
            var lastShowingIndex = slider.children.length - slider.settings.minSlides;
            var position = slider.children.eq(lastShowingIndex).position();
            // set the top position
            setPositionProperty(-position.top, 'reset', 0);//Change this line
        }
    // if not last slide
    }else{
        // get the position of the first showing slide
        var position = slider.children.eq(slider.active.index * getMoveBy()).position();
        // check for last slide
        if (slider.active.index == getPagerQty() - 1) slider.active.last = true;
        // set the repective position
        if (position != undefined){
            if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0);
            else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0);
        }
    }
}

换线:

setPositionProperty(-position.top, 'reset', 0);

setPositionProperty(position.top, 'reset', 0);

然后尝试

于 2013-03-11T10:18:54.797 回答
0

您可以设置自动放映幻灯片过渡的方向(autoDirection: 'prev')

$('.bxslider').bxSlider({  
    mode: 'vertical',  
    slideMargin:20,  
    minSlides: 4,  
    maxSlides: 4,  
    moveSlides: 1,  
    auto: true,  
    autoDirection: 'prev' /* <- */
});  
于 2016-01-06T07:27:16.370 回答