Gallery on a specific dynamic page

Hi,

I created a dynamic page which will have 9 pages overall. I would like to include a gallery on only one of those pages (the 9th page). I have set the gallery to collapsed on load and currently have the code shown below:

$w.onReady(function () {
});

export function getCurrentPageIndex(){
let pageCount = $w("#myDataset").getCurrentPageIndex();

if (pageCount === "9")
$w("#myElement").expand();
}

I would appreciate any feedback.

Thanks.

Hello.

I don’t think this will work on a dynamic page. I would recommend using the method in this tutorial to get current page index.

Good luck!