You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clicking on the play/pause button triggers the autoPlayToggleHandler function which toggles between the two buttons.
This logic is not called when calling the slickPause method. This can be easily fixed by moving the logic for the play/pause buttons directly into the slickPlay and slickPause function...
Original code:
Slick.prototype.autoPlayToggleHandler = function() {
var _ = this;
if(_.paused) {
_.$playIcon.css('display', 'none'); //to be extracted to slickPlay
_.$pauseIcon.css('display', 'inline'); //to be extracted to slickPlay
_.$pauseButton.find('.slick-play-text').attr('style', 'display: none'); //to be extracted to slickPlay
_.$pauseButton.find('.slick-pause-text').removeAttr('style'); //to be extracted to slickPlay
_.slickPlay();
} else {
_.$playIcon.css('display', 'inline'); //to be extracted to slickPause
_.$pauseIcon.css('display', 'none'); //to be extracted to slickPause
_.$pauseButton.find('.slick-play-text').removeAttr('style'); //to be extracted to slickPause
_.$pauseButton.find('.slick-pause-text').attr('style', 'display: none'); //to be extracted to slickPause
_.slickPause();
}
};
I have solved this exactly as I was suggesting above. I have moved the toggle logic into slickPlay and slickPause functions respectively, which means calling slickPause manually triggers the slickPause function which now also toggles the button states. Works as expected!
New code for Slick.prototype.autoPlayToggleHandler:
Clicking on the play/pause button triggers the autoPlayToggleHandler function which toggles between the two buttons.
This logic is not called when calling the slickPause method. This can be easily fixed by moving the logic for the play/pause buttons directly into the slickPlay and slickPause function...
Original code:
I have solved this exactly as I was suggesting above. I have moved the toggle logic into slickPlay and slickPause functions respectively, which means calling slickPause manually triggers the slickPause function which now also toggles the button states. Works as expected!
New code for Slick.prototype.autoPlayToggleHandler:
New code for Slick.prototype.slickPause
New code for Slick.prototype.slickPlay
The text was updated successfully, but these errors were encountered: