Home>Support>enhanceing the widget post-carousel with automatical viewing next articles

enhanceing the widget post-carousel with automatical viewing next articles

to do not alter the existing JS code I write a new function, for clicking the previous or next buttons after a few seconds.
At first I write a function to do the clicking of the buttons:

function loopstep() {
var p;
if (lauf >= 0) {
p = document.querySelector(“#sow-post-carousel-3 .sow-carousel-next”);
} else {
p = document.querySelector(“#sow-post-carousel-3 .sow-carousel-previous”);
}
p.click();
p = document.querySelector(“#sow-post-carousel-3 .sow-carousel-wrapper”);
if ( lauf > 0 ) {
lauf–;
if (lauf == 0) lauf = -p.getAttribute(“data-found-posts”);
} else {
lauf++;
if (lauf == 0) lauf = p.getAttribute(“data-found-posts”);
}
window.setTimeout(“loopstep()”, 10000); // Neuaufruf in 10 Sekunden
}

an then in a only one time executing routine I write the start call:

if (typeof(lauf) != ‘number’) { // only once
var lauf = 0;
var plauf = document.querySelector(“#sow-post-carousel-3 .sow-carousel-wrapper”);
if (plauf) {
lauf = plauf.getAttribute(“data-found-posts”);
if (lauf > 0) {
window.setTimeout(“loopstep()”, 15000); // Start in 15 Sekunden
} }
}

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More