Greetings,
This code:
function move(e) {
// prevent the click action
e.preventDefault();
// check if the carousel is mid-animation
if (!animating) {
// get the event's source element
var target = e.target || e.srcElement;
// find out if we are moving next or previous based on class
var next = target.classList.contains( 'next' );
var margin = 0;//= parseInt(items.style.marginLeft) || 0;
// allow our carousel to animate
container.classList.add( 'animate' );
animating = true;
var sky = 400;
if (next) {
margin = -( ( properties.width*4+sky )- properties.marginRight );
if ( active < items.children.length - 1 ) {
active+= 4;
} else {
active = 0;
}
} else {
margin = properties.marginRight;
if ( active > 0 ) {
active--;
} else {
active = items.children.length - 1;
}
}
items.style.marginLeft = margin + 'px';
}
}
I would like to change this part:
if (next) {
margin = -( ( properties.width*4+sky )- properties.marginRight );
if ( active < items.children.length - 1 ) {
active+= 4;
} else {
active = 0;
}
} else {
margin = properties.marginRight;
if ( active > 0 ) {
active--;
} else {
active = items.children.length - 1;
}
}
in responsive screens,
the active +=4
I want to change it in responsive screens and make it: active++
how do I do that?
I read about the
if (screen.width >= 600) {
// code here
}
but It didn’t work for me.