Skip to content

Instantly share code, notes, and snippets.

@shoken0x
Last active May 6, 2016 16:20
Show Gist options
  • Save shoken0x/cdbeb77c13baab51013a682b3c7f4b71 to your computer and use it in GitHub Desktop.
Save shoken0x/cdbeb77c13baab51013a682b3c7f4b71 to your computer and use it in GitHub Desktop.
invrement data-offset by click button
<html>
<head>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('#more_load').bind('click', function() {
var offset = $(this).data('offset');
var limit = $(this).data('limit');
alert(offset);
$(this).data('offset', offset + limit);
history.replaceState('','','/top' + '?offset=' + offset + '&limit=' + limit);
});
});
</script>
<button id="more_load" data-offset="4" data-limit="10">more load</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment