I’m trying to implement a Back to top button for Xojo Web.
Is there a quick hack for that? I’ve created one with a WebContainer (it’s working) but Its static position remains the same, I need it to follow the scrolling up/down. Can’t manage to have it relocated with Lock Right/Left while scrolling .
Wouldn’t it make more sense to always have the top button at the bottom right of the page? That way no matter how much you scroll it will always be at the bottom right of the page.
Actually, your screenshot is for Desktop, I’m looking for a Webpage bootstrap design (Xojo WebApplication) with behavior like this one W3Schools Tryit Editor
So lock right can be applied, but not the lock bottom, the Height must be changing as we are scrolling the webpage up and down, from the footer, mid-page etc…
Desktop or web, locking the button works the same. For Web if you really want it to work like that you will need to adapt the JavaScript to run in Xojo.
The position doesn’t matter, it depends on the “Right” and “Bottom” properties - I’ll change it someday. The width of the button matters.
If there’s a feature missing, I’ll be happy to add it
I ran this in the Debugger and the Scroll to Top button never showed up so I lengthened the page to 2000 pixels and added a TextArea with greeked text to fill the page length. When I ran again it worked as expected so I can only assume there needs to be some threshold of page length not visible for the button to work. If that is the case one would think that there should be a way to set that threshold.
I followed this example from w3schools.com
When I learned how to encrypt controls, I decided to do it because in the future I would like to publish all my controls, but of course I can make an exception (please download again)
Perfect my friend, and yes, if I change both 20 to 100 then the button will appear when scrolling top reaches 100px. If we change to 500+, then it will appear around the 2nd page, depending on the screen size.
I personally don’t know yet how to have it change into the “update control(data)”. I’m an SDK newbie.
As soon as I find out, I will post it here.
Just have to create a variable in JavaScript and have it link to something like below
if (typeof json.width !== 'undefined') {
this.buttonEl.style.width = `${json.width}px`;
}
Well, for now, thank you so much for the decrypted code.
Yes, many thanks for the decrypted version. It would be great if the control had a setting for the threshold under “Behavior” so you can encrypt it again. I’m not sure if you can do that with an SDK control though.