Disable loading animation masonry infinite scroll

2019-05-31 05:16发布

问题:

I'm trying to disable the annoying animation of the loading #infsrc-loading container. Take a look at the infinite scroll demo here http://masonry.desandro.com/demos/infinite-scroll.html.

The first time the loading div appears it's static but after that when it loads more content is has an animation, like it appears from the bottom and grows. I want to disable this, but I couldn't find where this is being set.

I tried disabling CSS transitions and $('#infsrc-loading').show() in the plugin's callback. I looked at the source of both Masonry and InfiniteScroll and still can't tell where this setting is being set. I have disabled animations in Masonry as well.

I'm using the WordPress plugin if that helps.

回答1:

I found the piece of code. It's on line 155 of Infinite Scroll. I just changed show to fadeIn to make it work how I needed it.



回答2:

Maybe some of this isn't necessary, but works for me:

<style>
  #infscr-loading { display:none; }
</style>

For initialization of infinitescroll, set these options:

loadingImg : "",
loadingText : "",
loading: {
    finishedMsg: "",
    msgText: "",
    img: "" }

Update: The last line here hides the blue animated progress bar gif.

I'm using this version:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>

If you can improve my answer, feel free to correct me :-)