Reputation: 303
on my website : http://www.entendu.info/ i'm using the waypoints plugin from http://imakewebthings.com/jquery-waypoints/
If the user scroll directly to the bottom, most of the waypoints ain't triggered, only the 2 first one and the last one, as if the middle ones are scrolled too fast to be executed. (waypoints are the social buttons which are loaded when scrolled )
Any help ? PS : head.ready is just an alternative of document.ready when using headjs to load external script.
head.ready(function() {
opts = {
offset: '85%',
continuous: 'true',
};
//$('.share-this').on('click', function(e){
$('.share-this').waypoint(function(event, direction) {
if (direction === 'down') {
var contentId = $('.share-this').attr('rel');
var uri = $('.share-this').attr('rev');
$.ajax({
url: 'http://www.entendu.info/share',
type: 'GET',
dataType: 'html',
data: {id:contentId, url:uri},
complete: function(xhr, textStatus) {
},
success: function(data, textStatus, xhr) {
$('#'+contentId).html(data);
},
error: function(xhr, textStatus, errorThrown) {
}
});
}
else {
// do this on the way back up through the waypoint
}
//});
$.waypoints('refresh')
}, opts);
});
Upvotes: 3
Views: 1261
Reputation: 370
I believe you can achieve what you want without having to use an extra jQuery plugin. Details can be found on this post so, all credit due where neccessary.
How to check if a user has scrolled to the bottom
The long story short is, you can use the scroll() already provided with the jQuery framework and compare the document height against the currently displayed window height. I don't want to steal someone elses thunder though, check out the links.
Upvotes: -1