How to tell if the page displayed in the Browser widget has scrolled
hh
hh at hyperhh.de
Thu Nov 8 05:45:13 EST 2018
The following works for me.
Write this code into a variable or a field:
window.onscroll = function() {
if (window.innerHeight + window.pageYOffset >=
document.body.offsetHeight) liveCode.jsNotify('I am at the bottom');
};
(a) Then script:
do <variableOrField> in widget "browser" if you can't control the htmltext.
or
(b) If you can control the htmltext then add the code above enclosed in
<script></script> tags right before </body>.
Set (another) javascriptHandler of the widget to "jsNotify" and script in
the widget or card, for example:
on jsNotify v
put the seconds && v into fld "info"
end jsNotify
Don't use an alert here: You will also get the alert when you scroll a little
bit up from the bottom. This small indeterminate region is also influenced by
the horizontal scrollbar of the browser widget (which you can't control).
Related:
http://forums.livecode.com/viewtopic.php?p=152156#p152156
http://forums.livecode.com/viewtopic.php?p=156745#p156745
p.s. Answering is easier in the forum, especially if your questions become
more complicated (as soon as the browser widget has won you over).
More information about the use-livecode
mailing list