google / material-design-lite

Material Design Components in HTML/CSS/JS
https://getmdl.io
Apache License 2.0
32.28k stars 5.03k forks source link

Problem with my scroll #3605

Closed Gesparo closed 8 years ago

Gesparo commented 8 years ago

Hello. I use mdl and want to make my native scroll on the page.

Code below doesn't work, maybe mdl change $(window).scrollTop() and $(window).height() :

$(window).scroll(function() { if($(window).scrollTop() + $(window).height() >= $(document).height() - 200 && !inProgress) {

And this code is works:

$('mdl-layout__container').scroll(function() { if($(window).scrollTop() + $(window).height() >= $(document).height() - 200 && !inProgress) {

but not correctly. I use previous function on another site without mdl, and it's work very well. Maybe somebody know how fix this?

Garbee commented 8 years ago

Scrolling on the window doesn't currently occur due to the way layout is handled. You've figured out on your own that you need to attach it to the layout container.

Beyond that information, we can't really help with this. It is custom code integrating MDL into a project which we can't help with since it isn't a problem with the code we provide. Please try using StackOverflow for support and integration help.

Henxed commented 8 years ago

@Garbee I ran into the same problem. It's a simple autoload news! Really It does not work due to the fact that MDL uses $(window). Is it possible to somehow decouple the parameter $(window)?

ravi292 commented 7 years ago

Instead of using above use this $('.mdl-layout__content').scroll(function() { if($('.mdl-layout__content').scrollTop() + $(window).height() >= $(document).height() - 200 && !inProgress) {

Reference link : - https://github.com/google/material-design-lite/issues/url

iHTCboy commented 6 years ago
$('html, body, div').scroll(function() {
     var offset = $('#overview').offset().top;
});