Search code examples
javascriptjquerycssjpage

Jpages not working


I have the following jpages code on jsfiddle where i am using a list of text and jpages to create pagination. However it is not working, even though I have referenced all of the relevent js libraries and included the javascript required.

http://jsfiddle.net/HV88U/

$(function () {
    /* initiate pugin assigning the desired button labels  */
    $("div.holder").jPages({
        containerID: "itemContainer",
        perPage: 2,
        first: false,
        previous: "span.arrowPrev",
        next: "span.arrowNext",
        last: false
    });
});

EDIT:

jPages is a client-side pagination plugin but it gives you a lot more features comparing to most of the other plugins for this purpose, such as auto page turn, key and scroll browse, showing items with delay, completely customizable navigation panel and also integration with Animate.css and Lazy Load.

http://luis-almeida.github.io/jPages/

The code is meant to paginate the list items, 2 per page, as can be seen in the parameters of the JS

EDIT

The only error messages I am recieving inside of visual studio 2012 are these below and seem to look non threatening

Message 1 JSHint (r10): Expected '!==' and instead saw '!='. jPages.js 250 41
Message 2 JSHint (r10): Expected '!==' and instead saw '!='. jPages.js 254 52
Message 3 JSHint (r10): Expected '!==' and instead saw '!='. jPages.js 265 74
Message 4 JSHint (r10): Expected '===' and instead saw '=='. jPages.js 268 26
Message 5 JSHint (r10): Expected '===' and instead saw '=='. jPages.js 269 26


Solution

  • My browser tells me, that jPages.js has a syntax error. The JavaScript is not being loaded. That is, why jPages is not defined for me.

    Do you see the same error?

    You are referencing https://github.com/luis-almeida/jPages/blob/master/js/jPages.js which is actually an HTML page. You would need to reference the "RAW" file. https://raw.githubusercontent.com/luis-almeida/jPages/master/js/jPages.js

    Try this:

    http://jsfiddle.net/p4LES/1/