Ayfri
08/14/2022, 9:16 PMDiv({
classes(AboutMeStyle.timeline)
window.addEventListener("scroll", {
val footerOffset = document.querySelector(".${AppStyle.footer}")?.asDynamic()?.offsetTop as Double? ?: return@addEventListener
val currentOffset by mutableStateOf(window.scrollY + 100)
if (currentOffset < footerOffset) {
style {
top(currentOffset.px)
}
}
})
})
If I put a console.log
inside the condition it gets called so it should be fine, but no style is set, what am I doing wrong ?Derek Ellis
08/14/2022, 9:45 PMattrs
block and the style
block outside of the "scroll" listener.
Like this:
var currentOffset by mutableStateOf(0)
Div({
style {
top(currentOffset.px)
}
window.addEvenListener("scroll", {
currentOffset = ...
}
})
Ayfri
08/14/2022, 9:55 PM