Hi all,
Situation:
I created a custom navigation bar, with a repeater that is connected to a dataset, which shows buttons for the different dynamic pages. When I am on one of these dynamic pages, I want this button to appear in a different color and with a bolded text.
Problem:
I’ve got the conditional styling of the button color working (see code below), but I can’t manage to style the button text conditionally.
According to the documentation:
The following styles can be used with buttons:
-
color
This means that I can’t use ‘button.style.fontWeight = 900’.
Does anyone know of any other solution/workaround to tackle this problem?
Any help is highly appreciated!
$w.onReady(function () {
//To load page before running the code
$w("#continentDataset").onReady(function () {
//To load the Continent dataset's data before running the following code
$w("#continentItem").onReady(function () {
//To load the Current Continent data before running the following code
let currentContinent = $w("#continentItem").getCurrentItem();
$w("#continentRepeater").onItemReady(($item, itemData, index) => {
let button = $item("#continentButton");
let buttonStyle = button.style;
let buttonTitle = itemData.title;
if (buttonTitle === currentContinent.title ) {
buttonStyle.backgroundColor = "#B0CCF3";
//buttonStyle.fontWeight = '900' // This doesn't work
} else {
buttonStyle.backgroundColor = "#FFFFFF";
}
})
})
})
});