나는 http://jquery.malsup.com/cycle2/api/을 사용하고 있으며 모바일 장치를 감지하면 윈도우 크기 조정 이벤트에서 cycle2 슬라이더를 파괴하려고합니다. 불행히도 다음과 같은 두 가지 오류가 반환됩니다.윈도우에서 Cycle2를 파괴하십시오
[cycle2] slideshow must be initialized before sending commands; "destroy" ignored
[cycle2] slideshow must be initialized before sending commands; "reinit" ignored
누군가 내가 도울 수 있습니까? 다음은 코드입니다.
$(function() {
var slider = $('.slider').cycle();
condition = true;
//destroy onload under condition
if(condition){
slider.cycle('destroy');
}
//destroy on resize
$(window).on('resize',function() {
condition = true; //Will be function to recondition let´s say it's true by now
if(condition){
slider.cycle('destroy');
} else {
slider.cycle('reinit');
}
});
});
고맙습니다.
if(condition){
slider.cycle('destroy');
}
당신은 그런 식으로 그것을 할 수 있습니다 : 당신이 여기에 슬라이더를 파괴하는 것 같은