Page does not switch

I made next previous button like this page

I think the code is work, but the page does not switch.
when push next or previous button, the URL does change but the page does not switch.
Why this happen?

URL:
https://risa73.wixsite.com/sankei01/control-page/テスト9

Hi Nanami!

I’ve seen the code on the page you sent and noticed that you used the function ‘$w.onReady’ multiple times.
Doing that cancels the functions and executes only the last time it is used.
Try and change it and once you fix it let us know if it works as you planned or If you have further questions regarding the issue and we’ll be glad to help!

Best of luck!
Doron. :slight_smile:

Doron Alkalay Thanks so much.
I trie it, but something wrong,
I can’t find out where is wrong,

the err is “link Field un read”

import {
local
}
from ‘wix-storage’;
import wixWindow from ‘wix-window’;

const linkField = “link-control-page-title-2”;

$w.onReady(function () {
if (wixWindow.rendering.env === “browser”) {
$w(“#dataset1”).onReady(() => {
const numberOfItems = $w(“#dataset1”).getTotalCount();

		$w("#dataset1").getItems(0, numberOfItems) 
			.then((result) => { 
				const dynamicPageURLs = result.items.map(item => item[linkField]); 
				local.setItem('control-page/{Title}', dynamicPageURLs); 
			}) 
			.catch((err) => { 
				console.log(err.code, err.message); 
			}); 
	}); 
} 

const linkField = "link-control-page-recomand-category"; 

if (wixWindow.rendering.env === "browser") { 
	$w("#dataset2").onReady(() => { 
		const numberOfItems = $w("#dataset2").getTotalCount(); 

		$w("#dataset2").getItems(0, numberOfItems) 
			.then((result) => { 
				const dynamicPageURLs = result.items.map(item => item[linkField]); 
				local.setItem('control-page/recomand/{Title}', dynamicPageURLs); 
			}) 
			.catch((err) => { 
				console.log(err.code, err.message); 
			}); 
	}); 
} 

if (wixWindow.formFactor === "Mobile" && 
	wixWindow.rendering.renderCycle === 1) { 
	$w("#button2").hide(); 
	$w("#button4").hide(); 
} 

});

Its solved.
In top page use 2 “linkField”
So I change the name “linkField1” and “linkField2”

import {
local
}
from ‘wix-storage’;
import wixWindow from ‘wix-window’;
const linkField1 = “link-control-page-title-2”;
$w.onReady(function () {
if (wixWindow.rendering.env === “browser”) {
$w(" #dataset1 “).onReady(() => {
const numberOfItems = $w(” #dataset1 “).getTotalCount();
$w(” #dataset1 “).getItems(0, numberOfItems)
.then((result) => {
const dynamicPageURLs = result.items.map(item => item [linkField1] );
local.setItem(‘control-page/{Title}’, dynamicPageURLs);
})
.catch((err) => {
console.log(err.code, err.message);
});
});
}
const linkField2 = “link-control-page-recomand-category”;
if (wixWindow.rendering.env === “browser”) {
$w(” #dataset2 “).onReady(() => {
const numberOfItems = $w(” #dataset2 “).getTotalCount();
$w(” #dataset2 “).getItems(0, numberOfItems)
.then((result) => {
const dynamicPageURLs = result.items.map(item => item [linkField2] );
local.setItem(‘control-page/recomand/{Title}’, dynamicPageURLs);
})
.catch((err) => {
console.log(err.code, err.message);
});
});
}
if (wixWindow.formFactor === “Mobile” &&
wixWindow.rendering.renderCycle === 1) {
$w(” #button2 “).hide();
$w(” #button4 ").hide();
}
});