Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6621757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:18:38+00:00 2026-05-25T21:18:38+00:00

In my script I load some posts from external RSS feeds. I have a

  • 0

In my script I load some posts from external RSS feeds. I have a “load more” button that when it is clicked, calls the loadfeed() function and shows some 10 more posts.

When this happens, there is a slideTo() that slides the browser to the first of the new posts list.

In addition to the “load more” button, I have a timer that checks for any new posts of those feeds. This happens every 3 minutes.

As I said, if you click on the “load more” button, the page is moved with the first new post on the top of your screen. The problem here is that this sliding happens also if you clicked once the “load more” button, you read the articles, and as you read the 3 minutes are passed, you slide back to the first post of the new list you loaded. More specific, when you load (from the default 20) +10 more posts, you will be slided to the 21st post after 3 minutes.

So my question here it is how to avoid this?

this is the #loadmore button that calls loadfeed()

$("#loadmore").click(function() {
    cap += 10;
    loadfeed();

});

and this is a part of loadfeed() that handles sliding. I have an if statement for the sliding to happen after the default 20 posts. Without this you will be slide to the 11 post after 3 minutes and no “load more” is clicked.

if (cap > 20) {
$(".p" + (cap-9)).slideto({
    slide_duration : 'slow'
});
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:18:39+00:00Added an answer on May 25, 2026 at 9:18 pm

    Forgive me if I’ve misunderstood, but can’t you just pass a parameter to loadfeed()?

    In $("#loadmore").click, call loadfeed(true) and for the timer call setTimeout(function () { loadfeed(false); }, 12000);. Or similar.

    Edit:

    I don’t know which slideto plugin you’re using. I’ve downloaded 2 of them, but neither works as yours seems to. I have got this to work with the scrollTo plugin.

    In this code, I’ve removed all of the AJAX bits and some other things that didn’t seem relevant to the question. The basic changes are to add a parameter to loadfeed() that tells it whether or not to scroll when adding new content. Clicking the button makes it scroll to the bottom; waiting for the timer does not. (I’ve also added a clearTimeout to stop the timer triggering multiple times if someone goes crazy with the load button.)

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title>Testing</title>
        <style type="text/css">
            .Top { background-color: #ccc; padding: 10px; position: fixed; }
        </style>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
        <script type="text/javascript" src="jquery.scrollTo.js"></script>
        <script type="text/javascript">
            $(function ()
            {
                var cap = 0;
                var timerId = null;
    
                function loadfeed(scroll)
                {
                    cap++;
                    $("#loadmore").hide();
                    $('#feed')
                    .addClass('loading')
                    .append("<div class=\"p" + cap + "\"><p>Biodiesel put a bird on it pitchfork beard cosby sweater tattooed, 3 wolf moon skateboard thundercats. Craft beer irony sartorial DIY. Portland photo booth trust fund, mlkshk yr you probably haven't heard of them salvia. Trust fund marfa food truck Austin etsy synth. Seitan chambray williamsburg, thundercats american apparel cardigan four loko letterpress food truck cosby sweater. Art party Austin biodiesel, single-origin coffee etsy organic mlkshk yr PBR. Skateboard master cleanse 3 wolf moon, freegan Austin tumblr messenger bag vinyl dreamcatcher.</p><p>Tumblr before they sold out helvetica, chambray iphone yr DIY cosby sweater PBR synth stumptown keytar. Letterpress you probably haven't heard of them iphone, keffiyeh photo booth chambray american apparel lomo artisan. Hoodie beard quinoa locavore four loko mixtape. Tofu stumptown viral you probably haven't heard of them, readymade thundercats echo park etsy 8-bit. Pitchfork ethical before they sold out, freegan keffiyeh yr marfa banh mi echo park williamsburg tofu PBR twee. Keffiyeh pitchfork food truck, gluten-free bicycle rights iphone fixie banh mi vinyl craft beer tofu keytar +1 brooklyn. Synth echo park letterpress locavore, chambray butcher banh mi vinyl tofu twee four loko food truck beard mustache fap.</p></div>")
                    .removeClass('loading');
                    if (timerId !== null) clearTimeout(timerId);
                    timerId = setTimeout(function () { loadfeed(false); }, 12000);
                    $("#loadmore").show();
    
                    if (scroll) $(window).scrollTo(".p" + cap);
                }
    
                loadfeed();
    
                $("#loadmore").click(function ()
                {
                    loadfeed(true);
                });
            });
        </script>
    </head>
    <body>
        <div class="Top"><button id="loadmore">Load</button></div>
        <div id="feed">Feed</div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C++ app that uses Python to load some scripts. It calls
I have a java script function that i have called on body load mousemove()
I have a Ruby script in my Rails app that I use to load
I need to pre-load some values from a php script, I'm using a $.post
We have some html that looks like this: <form id=MyUserControl runat=server method=post> <script language=javascript
I've got some trouble with jQuery script on my Asp.net page. During first load
I am working on a javascript app that users load via a configurable script
I have to request data for a JS-script from a MySQL database (based upon
I make a php script that receive from POST 4 image, than store them
I'm stuck trying to solve this. I'm plotting some information that I have in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.