Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with Javascript
#2
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.
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.
Reply


Messages In This Thread
Working with Javascript - by StephB - 03-22-2023, 10:21 AM
RE: Working with Javascript - by StephB - 03-23-2023, 08:53 AM
RE: Working with Javascript - by valmeras - 03-23-2023, 07:17 PM
RE: Working with Javascript - by valmeras - 03-23-2023, 11:27 PM
RE: Working with Javascript - by jeroen.rottink - 03-24-2023, 10:18 AM
RE: Working with Javascript - by StephB - 03-28-2023, 04:56 PM
RE: Working with Javascript - by valmeras - 06-28-2024, 08:29 AM
RE: Working with Javascript - by Comograma - 06-28-2024, 01:55 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)