Text is hidden by default but I’d like it to display when providing a specific URL.
Could anyone assist me, please?
Text is hidden by default but I’d like it to display when providing a specific URL.
Could anyone assist me, please?
if(url === “my-specific-url”){$w(“#myText”).show();}
Brilliant!
What would be the code to execute a function in this manner?
Brilliant!
What would be the code to execute a function in this manner?
Depends on what you are using it with, if it is after a user input from dropdown list, then simply use an onChange event or if it is on a user input with a submit button then use it with a onClick event etc.
@givemeawhisky The function is a button click that hides and shows text/strips dependent upon which button is clicked. The goal is to have a link to start with one of those functions already triggered.
The following are the functions with 1 example of the button being clicked:
function collapseAll3() {
$w(‘#busText’).collapse();
$w(‘#busText2’).collapse();
$w(‘#resText’).collapse();
$w(‘#medText’).collapse();
$w(‘#comText’).collapse();
$w(‘#serText’).collapse();
}
function collapseAll2() {
$w(‘#busClick’).hide();
$w(‘#resClick’).hide();
$w(‘#medClick’).hide();
$w(‘#comClick’).hide();
}
function collapseAll1() {
$w(‘#busStrip’).hide();
$w(‘#resStrip’).hide();
$w(‘#medStrip’).hide();
$w(‘#comStrip’).hide();
$w(‘#serStrip’).hide();
}
export function busBut_click(event, $w) {
//Add your code for this event here:
collapseAll1();
collapseAll2();
collapseAll3();
$w(‘#busStrip’).show();
$w(‘#busText’).expand();
$w(‘#busText2’).expand();
//SHOWING BUTTON
$w(‘#busClick’).show();
If it is just a button that the user will press, then just use onClick as shown here.
https://www.wix.com/corvid/reference/$w.Button.html#onClick
Just take note of the api code.
$w(“#myElement”).onClick( (event) => {
// This has the onClick event written into the code.
export function myElement_onclick(event) {
// This needs the onClick event to be turned on in the properties panel for that element.
I’m confusing myself. Maybe this would be easier. What would code be to make the link run the following function?
if (url === “my-specific-url”)
//Then make this happen:
export function busBut_click(event, $w) {
//Add your code for this event here:
collapseAll1();
collapseAll2();
collapseAll3();
$w(‘#busStrip’).show();
$w(‘#busText’).expand();
$w(‘#busText2’).expand();
//SHOWING BUTTON
$w(‘#busClick’).show();
}
did you leave me?