New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't make scrollbar follow new content added to overflow bottom. #901
Comments
Just use your JavaScript (call it from your go code) or write similar code using the JS interoperation ( |
The second option is the only one I can work with atm, what would an "app.Window()" line manipulating elements look like? |
I am very busy right now. I think I can show you some code later. |
That would be great, thx. |
Here some code fragment that shows similar stuff. I think you need "block" "end" with the target of the div you want to scroll. You could also set scroll top to the height (using if newURL.Fragment != "" {
target := app.Window().Get("document").Call("querySelector", "a[name='"+newURL.Fragment+"']")
if target.Truthy() {
opts := map[string]interface{}{ /*"behavior": "smooth",*/ "block": "start"}
target.Call("scrollIntoView", opts)
}
} else {
pc := app.Window().GetElementByID("pagecontent")
if pc.Truthy() {
pc.Set("scrollTop", 0)
}
} |
Thank you, but I actually solved it myself earlier today. I called "app.Script().Text()" and inside of Text() I wrote some simple JS code. Wish there would be a simpler way to interact with JS comands. |
@RadiactoR I think it is pretty simple to handle JS, it is more that the interfacing code is not that great, so we end up writing JavaScript and call it from Go at times. Emitting script from the renderer would not be my way to handle stuff. I think this is prone to edge cases, because of how the DOM is compared and updated with what you "Render()". But if it works like that, it is probably good enough. |
Since this is traditionally worked around using JavaScript, and there isn't any css property for it, there's currently no way (that I could find) to make an element's overflowing content make the scrollbar follow the newest content getting added at the bottom. For example, I have an element that is displaying live .log files, but as the div fills up, the scroll stays at the top of the list.
Is this an issue with go-app, or am I missing something?
The text was updated successfully, but these errors were encountered: