Skip to content

Instantly share code, notes, and snippets.

@forrestwilkins
Created January 30, 2015 18:13
Show Gist options
  • Save forrestwilkins/7f1ddb377980bb69d6f9 to your computer and use it in GitHub Desktop.
Save forrestwilkins/7f1ddb377980bb69d6f9 to your computer and use it in GitHub Desktop.
$(window).bindWithDelay("scroll", function() {
if($(window).scrollTop() + $(window).height() > $(document).height() - 150) {
if ($("#more_content_anchor")) {
var param = null;
if (document.URL.search("users") != -1) {
param = $.param({ user_id: document.URL.split("/")[4] });
} else if (document.URL.search("tabs") != -1) {
param = $.param({ tab_id: document.URL.split("/")[4] });
} else if (document.URL.search("notes") != -1) {
param = $.param({ notes: true });
}
if (param) {
$.ajax({
type: "GET",
url: "/pages/more",
data: param
});
}
}
}
}, 200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment