var itemPerPage = 4,
pageAmount;
$(document).ready(function()
{
pageAmount = Math.round($('.name').length / itemPerPage);
for(counter = 0; counter < pageAmount; counter++)
{
$('.navBtnWrapper').append
(
$(
'<div class="navBtn" data-pageIndex="' + counter + '">' +
(counter + 1) +
'</div>'
)
);
}
$('.navBtn').bind('click', navBtnHandler);
showPageData(0);
});
function navBtnHandler(event)
{
showPageData(parseInt($(this).data('pageindex')));
}
function showPageData(pageIndex)
{
$('.name').css({'display': 'none'});
$('.name').slice
(
(pageIndex * itemPerPage),
(pageIndex * itemPerPage) + itemPerPage
).css({'display': 'block'});
}
<div class="navBtnWrapper col-md-12"></div>