如何更改单击按钮时的javascript滑块选项

How to change javascript slider options on button click

本文关键字:javascript 选项 何更改 单击 按钮      更新时间:2023-09-26

因此,当用户单击滑块标记时,我想将"automatic"设置为false,代码如下:

$('#imageslider').bjqs({
  animtype      : 'fade',
    height        : 698,
    width         : 1920,
    responsive    : true,
    automatic           : <?= $manualAdvancing ?>,
    showcontrols    : false,
    animduration    : 450, // how fast the animation are
        animspeed       : <?= $delay ?>,
});

$('.bjqs-markers li').click(function() {
});

所以当执行.click时,#imageslider.bjqs选项中的automatic应该设置为false,我该怎么做?

通过滑块ID访问滑块,并尝试更改其"自动"值。

$('.bjqs-markers li').click(function() {
  var $slider = $("#imageslider");
  $slider.bjqs("automatic", false);
});

您尝试过吗:

var aut = <?= $manualAdvancing ?>;
$('#imageslider').bjqs({
  animtype      : 'fade',
  height        : 698,
  width         : 1920,
  responsive    : true,
  automatic           : aut,
  showcontrols    : false,
  animduration    : 450, // how fast the animation are
  animspeed       : <?= $delay ?>,
});

$('.bjqs-markers li').click(function() {
 aut=false;
});