pjax:send eventListener doesn't work #221

Closed
opened 2020-02-28 08:12:16 -05:00 by gggg990 · 0 comments
gggg990 commented 2020-02-28 08:12:16 -05:00 (Migrated from github.com)

Thanks for an interesting library @MoOx . I am trying to implement a white loading bar to the pjax code... I am also testing with logging the event to the console log but it only get's fired when there's a fresh restart of the whole page not just one section. Ideally I want to see it working also when changing page sections without a full reload.

This is my code:
var pjax;
var whiteloading;

document.addEventListener("DOMContentLoaded", function() {
// Init Pjax instance
pjax = new Pjax({
elements: "a", // default is "a[href], form[action]"
selectors: ["title", ".js-Pjax"],
cacheBust: false
});
});
whiteloading = $(".whiteloading");
whiteloading.show();

document.addEventListener("pjax:send", console.log("start"));
document.addEventListener("pjax:success", console.log("done"));

Thanks for an interesting library @MoOx . I am trying to implement a white loading bar to the pjax code... I am also testing with logging the event to the console log but it only get's fired when there's a fresh restart of the whole page not just one section. Ideally I want to see it working also when changing page sections without a full reload. This is my code: var pjax; var whiteloading; document.addEventListener("DOMContentLoaded", function() { // Init Pjax instance pjax = new Pjax({ elements: "a", // default is "a[href], form[action]" selectors: ["title", ".js-Pjax"], cacheBust: false }); }); whiteloading = $(".whiteloading"); whiteloading.show(); document.addEventListener("pjax:send", console.log("start")); document.addEventListener("pjax:success", console.log("done"));
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: iLoveElysia/pjax#221