Navigation drop-down list based on dynamic item page

Question:
Is it possible to make a navigation drop down list based on a dynamic item page?

Product:
I am using the Wix Editor

What are you trying to achieve:
I want to add a drop down list in my menu based on a dynamic item page. When I edit a dynamic item page, I see this kind of drop down list, showing my different Items and I can navigate between the different items using this drop-down menu. In the preview mode (or in the published site), I can only navigate using previous and next buttons. I would like to have a similar drop-down list to quickly navigate between the different dynamic item pages. Is this possible and how can I implement this ?

What have you already tried:
I have not found any clear instructions on how to do this.

Additional information:

I think this would only be possible to do with Velo code. I wrote some that just needs a bit of name changes and it should work

$w.onReady(function () {

	let items = null
	wixData.query("databaseName").find().then((results)=>{
		items = results.items

		let optionsArray = []
		items.forEach((item)=>{
			optionsArray.push({label: item.title, value: item.title})
		})

		$w("#dropdownName").onChange(()=>{
			wixLocationFrontend.to(items[$w('#dropdownName').selectedIndex]["something-link"])
			
		})
	})

});
1 Like

I think Simen’s right on this one.

Would just need to assign the optionsArray to the dropdown element before the onChange handler.

$w("#dropdownName").options = optionsArray

Other than that, as Simen mentioned, just a few small changes to customise to your needs :slight_smile:

Thanks. I will give it a go and let you know how I got on.