Giter VIP home page Giter VIP logo

jquery.pageless's Introduction

PageLess - endless page

Description

Pageless is a jQuery plugin. As you scroll down you see more results coming back at you automatically. It provides an automatic pagination in an accessible way : if javascript is disabled your standard pagination is supposed to work.

Parameters

  • currentPage: current page (params[:page])
  • distance: distance to the end of page in px when ajax query is fired
  • loader: selector of the loader div (ajax activity indicator)
  • loaderHtml: html code of the div if loader not used
  • loaderImage: image inside the loader
  • loaderMsg: displayed ajax message
  • pagination: selector of the paginator divs. (if javascript is disabled paginator is required)
  • params: paramaters for the ajax query, you can pass auth_token here
  • totalPages: total number of pages
  • url: URL used to request more data
  • method: HTML method for call URL, default - get
  • scrape: A function to modify the incoming data. (Doesn't do anything by default)
  • complete: A function to call when a new page has been loaded (optional)
  • end: A function to call when the last page has been loaded (optional)

Requirements

Then just navigate to http://localhost:3000 and enjoy!

Demo (Rails 3)

Demo is a Rails 3 app that just runs. It demonstrates the basic usage of pageless scrolling.

$ bundle install
$ rails s

Then just navigate to http://localhost:3000 and enjoy!

Usage

$('#results').pageless({ totalPages: 10
                       , url: '/articles/'
                       , loaderMsg: 'Loading more results'
                       });

Thanks to

Contributors

jquery.pageless's People

Contributors

aegorov avatar amenzhinsky avatar binarykitten avatar bonds avatar dennysfredericci avatar jney avatar nagybence avatar nevernormal1 avatar optiminimalist avatar overbryd avatar richardiux avatar zubin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery.pageless's Issues

jsp page

sir,
how can we implement using jsp pages

wen i try to load the same page gets repeated inside the page itself

I am newbie to jquery

pls help

Thanks and Regards
aravchr

Doesn't Work With Fixed Layouts

I am using a fixed layout so my navigation menu is always visible on the left side of the page. My content then scrolls as normal. With this setup, this plugin does not work correctly.

Long story short... 'distance' will never be zero, so the call is never made for additional data. $(window).scrollTop() will always be zero, even if you are at the bottom of the page.

More details using Firebug console:
$(document).height()
=> 1176

$(window).scrollTop()
=> 0

distance
=> 952

$.pageless.settings.distance
=> 100

(distance < $.pageless.settings.distance)
=> false

When CSS is disabled, the call is made.

Turbolinks support??

Currently in a rails 4 app it works as it should unless you are running Turbolinks. If you run Turbolinks, then it renders as the typical will_paginate pagination links.

Example app doesn't work

The example app doesn't work.
Also it's in Rails 2.2.2 - why not have better instructions for Rails 3.x?

undefined method `pageless' for

Hi!

I'm trying to use pageless and used your demo but I'm getting this error: undefined method `pageless' for #<#Class:

Any suggestion?

Thank you.

Scroll on container doesn't behave properly

Hi, I encountered a bug that occured using these steps:

  1. Design a div to use overflow: scroll so we can scroll on it.
  2. Set pageless to use that div as container (e.g $(x).pageless({container: x})).
  3. Load all the javascript (jquery.pageless.js and the code above) in the body, not head.

Buggy behavior:

  1. Scroll on the div. The pageless script doesn't work.
  2. Scroll on body. The pageless script works.

Wanted behavior:
Scroll on the div. The pageless script works and loads the next page.

The fix is really simple, just add this line below here; in init function:
if (settings.container) container = settings.container;

Boostrap 3 - table tbody ...

Friend, implemented by the boostrap 3.

$ ('# customers tbody'). pageless (opts.to_json # {});

Is loading perfectly, however the div <div id = "pageless-loader" .... Being loaded into the table place a drop layout ...

I like caregada below the table? or other

off the table?

iframe support?

My container is inside an iframe, still I want the pageless effect when the outer frame(browser window in my case) reaches the bottom.
Is that possible and how?

Can only load js from head

How can I get the JS to load from the body? I'm optimizing my site so all JS is loaded last (before the closed body tag) but the endless js doesn't seem to want to work when placed there. Any suggestions?

Thanks

Documentation lacking

Please provide more explanations of how to use the different options, including which ones can also take functions and how to use them for great effect!

Thanks!

Feature: Adding done function to allow people to trigger javascript after ajax call

What do you guys think of adding something to easily trigger javascript after the ajax request, say for example if you have Bootstrap tooltips in your content??

// finally ajax query
  $.ajax({
    data: requestParams,
    dataType: 'html',
    url: url,
    method: settings.method,
    success: function (data) {
      if ($.isFunction(settings.scrape)) {
        data = settings.scrape(data);
      }
      if (loader) {
        loader.before(data);
      } else {
        element.append(data);
      }
      loading(false);
      // if there is a complete callback we call it
      if (settings.complete) {
        settings.complete.call();
      }
    }
  }).done(function() {
    // Easily add javascript triggers like Bootstrap tooltip
    $(".tooltip").tooltip();
  });

Not a huge deal, just something to make it easier for people to use this library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.