03-23-2023, 08:53 AM
(This post was last modified: 03-23-2023, 09:48 AM by StephB.
Edit Reason: need 2 distinct posts
)
I tried to add my event using Self.Javascript.Add command in my FormShow, but the JS code is added in the header in this case, so when the page is loaded, the code is executed before the page is built, so my element is not already created and I got an error.
Any other solution ?
Done using basic HTML style, I added my JS script in my HTML template, works fine even if the JS script is not included in the project and compiled with Delphi.
If someone knows how to use the method descibes in the 1st post, I'm still interessted by the solution.
Code:
Self.JavaScript.Add('document.getElementById("IWURLWINLESSON").addEventListener("scroll", (event) => {' + #13#10 +
' if ((event.contentWindow.document.body.scrollHeight - event.offsetHeight) == event.contentWindow.document.body.scrollTop ) {' + #13#10 +
' console.log("End");' + #13#10 +
' } else {' + #13#10 +
' console.log("Scroll");' + #13#10 +
' }' + #13#10 +
'})');
Any other solution ?
Done using basic HTML style, I added my JS script in my HTML template, works fine even if the JS script is not included in the project and compiled with Delphi.
If someone knows how to use the method descibes in the 1st post, I'm still interessted by the solution.