Slick 滑块 - 更改输入焦点事件的可拖动状态
Slick slider - Change draggable state on input focus event
我在输入字段中尝试删除可拖动选项(这样我就可以 select 文本并使用箭头在字段内导航)。
var slider = $('.slider').slick({
infinite: false,
speed: 300,
slidesToShow: 1,
adaptiveHeight: true,
asNavFor: '#menu-mobile',
draggable: true
});
$('input').focusin(function () {
console.log('in');
slider.slickSetOption("draggable", false, false);
}).focusout(function () {
console.log('out');
slider.slickSetOption("draggable", true, false);
});
它returns
Uncaught TypeError: undefined is not a function
两个事件。
如何通过事件更改 draggable/swipe 状态?
插件仅注册功能jQuery.fn.slick
。
Methods are called on slick instances through the slick method itself in version 1.4
需要这样称呼:
// pseudocode
slider.slick("method", arguments, ...)
修复您的代码更改:
// wrong
slider.slickSetOption("draggable", false, false);
至:
// correct
slider.slick("slickSetOption", "draggable", false, false);
//Arguments: option : string, value : depends on option, refresh : boolean
我在输入字段中尝试删除可拖动选项(这样我就可以 select 文本并使用箭头在字段内导航)。
var slider = $('.slider').slick({
infinite: false,
speed: 300,
slidesToShow: 1,
adaptiveHeight: true,
asNavFor: '#menu-mobile',
draggable: true
});
$('input').focusin(function () {
console.log('in');
slider.slickSetOption("draggable", false, false);
}).focusout(function () {
console.log('out');
slider.slickSetOption("draggable", true, false);
});
它returns
Uncaught TypeError: undefined is not a function
两个事件。
如何通过事件更改 draggable/swipe 状态?
插件仅注册功能jQuery.fn.slick
。
Methods are called on slick instances through the slick method itself in version 1.4
需要这样称呼:
// pseudocode
slider.slick("method", arguments, ...)
修复您的代码更改:
// wrong
slider.slickSetOption("draggable", false, false);
至:
// correct
slider.slick("slickSetOption", "draggable", false, false);
//Arguments: option : string, value : depends on option, refresh : boolean