Skip to content

Instantly share code, notes, and snippets.

View henriklindgren's full-sized avatar

Henrik Lindgren henriklindgren

View GitHub Profile
@henriklindgren
henriklindgren / simple-pagination.js
Last active August 12, 2022 14:01 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
range = [],
previous = 1;
range.push(1);
for (var i = 2; i < last; i++) {
if (i < current && current - i === delta){