我正在使用下面的代码进行分页,这是我从这个链接得到的。http://botmonster.com/jquery-bootpag/#.V5qvJ-0sjVM,但它不适合我。
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="//raw.github.com/botmonster/jquery-bootpag/master/lib/jquery.bootpag.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>
<div id="content">Dynamic Content goes here</div>
<div id="page-selection">Pagination goes here</div>
<script>
// init bootpag
$('#page-selection').bootpag({
total: 10
}).on("page", function(event, /* page number here */ num){
$("#content").html("Insert content"); // some ajax content loading...
});
</script>
</body>
</html>我是jquery的新手。请检查一次,让我知道我正在做的错误。
谢谢。
发布于 2016-07-30 02:00:23
问题是您不能直接链接来自github的文件。或者将其本地上传到您的环境中,或者将链接更改为如下所示:
//rawgit.com/botmonster/jquery-bootpag/master/lib/jquery.bootpag.min.js,因此您的导入如下所示:
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="//rawgit.com/botmonster/jquery-bootpag/master/lib/jquery.bootpag.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">https://stackoverflow.com/questions/38649135
复制相似问题