currency.js
773 Bytes
var $ = require('jquery'),
loading = require('../plugin/loading');
var page = 1;
loading.showLoadingMask();
function ajaxCurrencyDetail(page) {
$.ajax({
type: 'POST',
url: '/home/ajaxCurrencyDetail',
dataType: 'html',
data: {
page: page
},
success: function(data) {
$('.coin-detail').append(data);
window.rePosFooter();
}
});
}
function scrollHandler() {
if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) {
page++;
ajaxCurrencyDetail(page);
return;
}
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
ajaxCurrencyDetail(page);
$(document).ready(loading.hideLoadingMask);