
import {local} from 'wix-storage-frontend'; const linkField = "items"; // replace this value $w.onReady(function () { $w("#Items").onReady(() => { const numberOfItems = $w("#Items").getTotalCount(); $w("#Items").getItems(0, numberOfItems) .then( (result) => { const dynamicPageURLs = result.items.map(item => item[linkField]); local.setItem('dynamicPageURLs', dynamicPageURLs); } ) .catch( (err) => { console.log(err.code, err.message); } ); } ); } ); import {local} from 'wix-storage-frontend'; import wixLocationFrontend from 'wix-location-frontend'; $w.onReady(function () { $w("#previous").disable(); $w("#next").disable(); if (local.getItem('dynamicPageURLs')) { const dynamicPageURLs = local.getItem('dynamicPageURLs').split(','); const currentPage = '/' + wixLocationFrontend.prefix + '/' + wixLocationFrontend.path.join('/'); const currentPageIndex = dynamicPageURLs.indexOf(currentPage); if (currentPageIndex > 0) { $w("#previous").link = dynamicPageURLs[currentPageIndex - 1]; $w("#previous").enable(); } if (currentPageIndex < dynamicPageURLs.length - 1) { $w("#next").link = dynamicPageURLs[currentPageIndex + 1]; $w("#next").enable(); } } } );