Hello,
can someone help me? I need a drop down menu where each option links to a separate page (not the same menu as main menu). The drop down boxes I can find don’t seem to be able to link through to a page.
It is so I can route people depending on what kind of person they are. It’s for a child’s mental health charity and I want to ask people first if they are a young person/parent/carer or professional and route them to the relevant page.
can anyone offer any advice of how to do this please?
much appreciated!
claire
You can add a Dropdown element to your page, and then based on the Dropdown selection use the wixLocation.to() function to go to the selected page. You can do something like this:
import wixLocation from 'wix-location';
$w.onReady(function () {
// set the dropdown options
$w("#dropdown").options = [
{ "label": "ONE", "value": "one" },
{ "label": "TWO", "value": "two" },
{ "label": "THIRD", "value": "three" }
];
// when an option is selected, go to the page
$w("#dropdown").onChange((event) => {
let goto = '/' + event.target.value;
wixLocation.to(goto);
});
});
Another, more robust option, would be to use a Repeater, and build your own dropdown with page links as the Repeater Items.
Hi, I used this , but instead of text and “read more” I just used a button as a dropdown and inside the multi-state box I had other buttons redirecting to different pages.