Pnewcode2023
New Coder
Hello, I have the following code below. This works for stopping the interval when the visitor scrolls up the page (the page is reverse scrolled and positioned to the bottom). This is a basic chat project I'm working on.
What I'm attempting to do is have a popup button show up when the user begins to scroll up, much like the chat in Twitch, that says "chat paused for scrolling" if they click it, then they are sent to the bottom of the page and the interval starts again.
Side note: This is all in an include that is on another page. What I have still works, but the bottom is actually at 180px from the bottom of the parent page. I'm not sure if that matters or not.
Any thoughts on how I can do this? Several days of searching only gives me "scroll to top" of the page examples and tutorials, and for some reason even those don't seem to work when viewing the page in the parent page (I thought I could reverse it if it did) so I'm thinking that what I have, has to have this included in it, itself.
This is what I have
What I'm attempting to do is have a popup button show up when the user begins to scroll up, much like the chat in Twitch, that says "chat paused for scrolling" if they click it, then they are sent to the bottom of the page and the interval starts again.
Side note: This is all in an include that is on another page. What I have still works, but the bottom is actually at 180px from the bottom of the parent page. I'm not sure if that matters or not.
Any thoughts on how I can do this? Several days of searching only gives me "scroll to top" of the page examples and tutorials, and for some reason even those don't seem to work when viewing the page in the parent page (I thought I could reverse it if it did) so I'm thinking that what I have, has to have this included in it, itself.
This is what I have
JavaScript:
startInterval();
$(document).ready(function() {
$(document).on('scroll', function() {
stopInterval();
var scrollTopPosition = $(document).scrollTop();
console.log('Scroll position:', scrollTopPosition);
// Your other jQuery code here...
});
});