Search code examples
jqueryjssor

Jssor Freeze API


I have a Jssor slider with the following options:

var defaults = {
  $AutoPlay: true,
  $AutoPlaySteps: 1,
  $Idle: 0,
  $SlideDuration: 20000,
  $SlideEasing: $JssorEasing$.$EaseLinear,
  $PauseOnHover: 4,
  $DragOrientation: 1,
};

The "Freeze" on hover works perfectly, but I am looking for an API method to do the same thing. The closest I have found is $Pause, but this appears to wait for the end of the current SlideDuration before actually stopping.

Is there any way to achieve an instant freeze of the slider?


Solution

  • It looks like I've hacked it together like so in jssor.slider.mini.js

    Between:

    h.$Pause=function(){P=l};
    

    And:

    h.$Play=function(){if(!P){P=d;C[s]&&C[s].Bc()}};
    

    I added the following:

    h.$Freeze=function(){F=1;ic()};