pklauzinski / jscroll

An infinite scrolling plugin for jQuery.
http://jscroll.com/
1.11k stars 563 forks source link

Support sending URL params. #170

Closed Leodau closed 3 years ago

Leodau commented 5 years ago

This is an enhancement request,

JSCROLL should absolutely support url query options, let's say you need to send filters to your backend to get different result.

'?customParams=data' 🙃🙃

piterjov commented 4 years ago

Any update on this

eqxDev commented 3 years ago

You can do this with the callback function and window history.


var url = new URL(window.location.href);
var page = url.searchParams.get("page");
if (page == null) {
   page = 1;
}
page = parseInt(page) + 1;
url.searchParams.set("page", page);
var newUrl = url.href;
history.pushState(null, null, newUrl);```