4

I'm using the standard way of detecting the scroll position to enable a button when the user scrolls to bottom. it works fine on 100% zoom until you zoom out.

http://jsfiddle.net/ruslans/94qmk4t6/ (try zooming out to 90%/75%)

       function ViewModel() {
           this.scrolledToBottom = ko.observable(false);
           this.onScroll = function (data, event) {
               var el = event.target,
                   $el = $(el),
                   scrollPosition = $el.scrollTop() + $el.innerHeight();

               if ($el.scrollTop() === 0) return;
               this.scrolledToBottom(scrollPosition >= (el.scrollHeight));
           };
       }

is there a neat workaround i could use?

Siguza
  • 21,155
  • 6
  • 52
  • 89
Ruslan
  • 9,927
  • 15
  • 55
  • 89

1 Answers1

0

Here's a link to an answer talking about checking viewport and the DOM. There are a few links to follow if you need some more specific answers.

Concerning your question and how you're attacking the problem, you're checking for on scroll events. I think your solution should solve your issue for smaller texts as well as scrollable ones. Your issue may manifest in other ways, such as higher resolution screens (4k's are becoming popular) not having scroll bars because of larger windows.

Community
  • 1
  • 1
Eliasar
  • 1,067
  • 1
  • 7
  • 18