ryanve / response.js

Responsive design toolkit
http://responsejs.com
Other
801 stars 123 forks source link

overflowX / overflowY #6

Closed ryanve closed 12 years ago

ryanve commented 12 years ago

I've been in the process of improving the docs (beta docs here) and when I got to the overflowX / overflowY methods I was like, whoa these are gonna sound confusing and most people aren't going to use them anyway. We'd had these in there as handlers for inViewport methods, but since version 0.5 we're using getBoundingClientRect and overflowX / overflowY are no longer used internally. IMO it makes sense to depreciate them in 0.6 unless...are there objections? The code is below. It's a native equivalent to $(document).height() - $(window).height() (dims info here) When it's all gzipped the size difference is minimal but still seems like we may as well cut them now rather than support them forever.

function overflowY() {
    // Get the number of pixels that the document width exceeds viewport width.
    var html = document.documentElement
        // document height minus viewport height
      , difference = Math.max(html.offsetHeight, html.scrollHeight, document.body.scrollHeight) - html.clientHeight;
    return 0 < difference ? difference : 0;
}
ryanve commented 12 years ago

These 2 methods were removed in 0.6.0. If you still need this functionality, use:

$(document).width() - $(window).width()

and

$(document).height() - $(window).height()