let up = true;
let down = true;
let screenCounter = 0;
let incrementBy = 1;
let defaultTftMode = "light";
const lengthOfScreen = 4;
// direction would be up or down
function changeScreen(direction = null) {
if (direction === "up") {
if (up == true && screenCounter <= lengthOfScreen) {
if (screenCounter === lengthOfScreen) {
screenCounter = 0;
}else{
screenCounter += incrementBy;
}
} else {
screenCounter = 0;
up = true;
}
}else if(direction === "down"){
if (down == true && screenCounter !== 0) {
screenCounter -= incrementBy;
if (screenCounter === 0) {
down = false;
}
} else {
screenCounter = lengthOfScreen;
down = true;
}
}
console.log('screenCounter value is', screenCounter);
}
-
-
Save Neeraj1005/803cf4f4bf119f4842fb8073494f9292 to your computer and use it in GitHub Desktop.
slider next and previous button incrementation and decrementation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment