我在我的网页上使用BxSlider这是一个Jquery插件。我将滑动模式设置为“垂直”,但默认的滑动方向是从下到上移动,但我想将其更改为从上到下移动。但我无法弄明白。任何建议都会非常感激
答案 0 :(得分:1)
您可以使用定位设置滑块箭头的位置。例如,我们将滑块'箭头'定位设置为绝对,上箭头顶部,下一个箭头底部。
答案 1 :(得分:0)
为此,您必须更改此core code
plugin
插件
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);
然后尝试
答案 2 :(得分:0)
您可以设置自动显示幻灯片切换的方向(autoDirection: 'prev')
$('.bxslider').bxSlider({
mode: 'vertical',
slideMargin:20,
minSlides: 4,
maxSlides: 4,
moveSlides: 1,
auto: true,
autoDirection: 'prev' /* <- */
});