header color change as scrolling down

hi all,

i currently have a black header on my pages. i want it to start off as transparent and turn black as it passes the anchor. i used the following code:

export function anchor1_viewportEnter ( event ) {
$w ( “#header1” ). style . backgroundColor = ‘rgba (0,0,0,0)’
}

export function anchor1_viewportLeave ( event ) {
$w ( “#header1” ). style . backgroundColor = ‘rgba (0,0,0,1)’
}

but it doesn’t seem to work out. header is still black from the start. can you help?

This one surely works…

$w('#header1').style.backgroundColor = "black"
$w('#header1').style.backgroundColor = "rgb(0,0,0)"

Do not forget to set the head-color to 100% in the header-options.

hi again, i used the following and it worked:

export function anchor1_viewportEnter ( event ) {
$w ( “#header1” ). style . backgroundColor = “rgba(0, 0, 0, 0.0)”
}

export function anchor1_viewportLeave ( event ) {
$w ( “#header1” ). style . backgroundColor = “rgba(0, 0, 0, 1.0)”
}

thank you!