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 7900193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:54:30+00:00 2026-06-03T08:54:30+00:00

I’m having trouble undesrtanding how the script exacly works, and what can i do

  • 0

I’m having trouble undesrtanding how the script exacly works, and what can i do to improve it, minify etc. I’d also like to find a way for appending button, that would stop the function (sort of disable autoloading of content button), do you have any idea? Here’s the code: (the most important part for me is to understand the code)

var page = 1;
var pageLast = 1;
var stop = false;
function lastPostFunc() 
{ 

    $('div#loading').html('loading data ...') ;
    page += 1;
    if (page+1 > pageLast) {
        stop=true;
    }
    var objURL = new Object();
    window.location.search.replace(
        new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
        function( $0, $1, $2, $3 ){
        objURL[ $1 ] = $3;
        }
        );
    q = '?strona='+page
    for (var k in objURL){
        if (k != 'strona' ) 
            q += ('&'+k+'='+objURL[ k ])
    }
    data = $('<div/>').load( "/shop/category/example/" + q +' #produkt_lista',function() {
        $('.produkt .opis',$(this)).each( function() { $(this).css('display', 'none'); } );
        $('a.jt').cluetip({ cluetipClass: 'jtip', arrows: true, dropShadow: false, hoverIntent: false, sticky: false, mouseOutClose: true, showTitle: false, closeText: 'zamknij', width: 300, positionBy: 'mouse', topOffset: 0});
    });
    if (data != "") {
        $('.paginator').hide();       
        $("#produkt_lista").append(data);            
    } 
    $('div#loading').empty();
}; 

$(document).ready(function() { 

pageLast = parseInt( $('.paginator .paginate-pages').first().text().replace('Stron: ',''));
$('#produkt_lista').after( $('<div id="wczytywanie" style="display: none; font-weight: bold; font-size: 20px; line-height: 40px; color: red; margin: 20px auto; width: 300px; border: 1px solid red;"></div>') );
$(window).scroll(function(){
        if  ($(window).scrollTop()+200 > $(document).height() - $(window).height()){
           if (!stop) lastPostFunc();
        }
});
} );
  • 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-06-03T08:54:31+00:00Added an answer on June 3, 2026 at 8:54 am

    The script basically binds that lastPostFunc() function to the $(window).scroll() event. It says if the user scrolls down to the bottom 200px of the screen, JavaScript should fire that function.

    All the function does is show a loading div, likely a modal or overlay, and then fetches the next page of data:

    • /shop/category/example/?strona=1#produkt_lista
    • /shop/category/example/?strona=2#produkt_lista
    • /shop/category/example/?strona=3#produkt_lista

    ..and so on. It then iterates over all the nodes which match the CSS class .produkt .opis and hides them using $(this).css('display','none');. It should just be using $(this).hide();, but it’ll work either way.

    After that it binds a cluetip plugin to all the anchors with the class .jt and passes in some various plugin parameters. I imagine that is so you can hover those with your mouse and some fancy tooltip will appear near your cursor.

    Finally it checks if data is not empty and hides the paginator element (dont know why) and appends the newly fetched HTML-wrapped data to the existing data inside #produkt_lista.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.