I have a project I am working on. I have a dropdown of list, and once you select from the list the button enables with the label matching what was selected. Now I am wondering, if there is a way to have the button load for a certain time and than redirects them to the page???
You can click here to see my project so far.
Here is my code:
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w('#countyList').placeholder = "Select Your Country To Get Started";
$w('#button5').disable();
$w('#button5').label = "Select a County";
$w("#countyList").options = [
{"label": "Beaver County", "value": "/beaver-county"},
{"label": "Box Elder County", "value": "/box-elder-county"},
{"label": "Cache County", "value": "/cach-county"},
{"label": "Carbon County", "value": "/carbon-county"},
{"label": "Daggitt County", "value": "/daggitt-county"},
{"label": "Davis County", "value": "/davis-county"},
{"label": "Duchesne County", "value": "/duchesne-county"},
{"label": "Emery County", "value": "/emery-county"},
{"label": "garfield County", "value": "/garfield-county"},
{"label": "Grand County", "value": "/grand-county"},
{"label": "Iron County", "value": "/iron-county"},
{"label": "Juab County", "value": "/juab-county"},
{"label": "Kane County", "value": "/kane-county"},
{"label": "Millard County", "value": "/millard-county"},
{"label": "Morgan County", "value": "/morgan-county"},
{"label": "Piute County", "value": "/piute-county"},
{"label": "Rich County", "value": "/rich-county"},
{"label": "Salt Lake County", "value": "/salt-lake-county"},
{"label": "San Juan County", "value": "/san-juan-county"},
{"label": "Sanpete County", "value": "/sanpete-county"},
{"label": "Sevier County", "value": "/sevier-county"},
{"label": "Summit County", "value": "/summit-county"},
{"label": "Tooele County", "value": "/tooele-county"},
{"label": "Uintah County", "value": "/uintah-county"},
{"label": "Utah County", "value": "/utah-county"},
{"label": "Wasatch County", "value": "/wasatch-county"},
{"label": "Washington County", "value": "/washington-county"},
{"label": "Wayne County", "value": "/wayne-county"},
{"label": "Weber County", "value": "/weber-county"}
];
})
export function countyList_change(event) {
$w('#button5').enable();
let options = $w('#countyList').options; // this is the code to make sure options is defined. <<<
let idx = $w('#countyList').selectedIndex
$w('#button5').label = options[idx].label;
}
export function button5_click(event) {
let goToUrl = $w('#countyList').value;
wixLocation.to(goToUrl);
}
I am wanting to have the button load for a certain amount of time (Let’s say 4-5 seconds and than the page redirects to the page after clicking the button. I know there is a way for a preload screen, but how can I apply a preload to a button?