Skip to content

aesqe/flourish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flourish

Load all your site links using AJAX.

Similar to pjax, but has no dependencies and is less than 5kb minified.

Will add a history.pushState entry if supported, should work with anything >= IE8.

var flourish = new Flourish({
	extractSelector: "#main",
	replaceSelector: "#main",
	bodyTransitionClass: "loading",
	replaceDelay: 500
});

flourish.on("post_fetch", function( options, output ) { ... });
flourish.on("post_replace", function () { ... });

window.addEventListener("popstate", ajaxLoadLink);
document.body.addEventListener("click", function(e) {
	if( target.tagName.toLowerCase() === "a" ) {
		ajaxLoadLink(e);
	}
});

function ajaxLoadLink (e) {
	...

	flourish.fetch({
		url: url,
		eventType: e.type,
		onerror: function( request, options, self ) {
			...
		}
	});
}

About

Load all your site links using AJAX.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published