我有兴趣使用jQuery根据内容和div的高度而不是按项目数创建内容的自动分页.我能够找到的大多数分页示例都是基于要分页的项目数,而不是包含div的高度和内容的高度.该解决方案不适用于不同长度的内容.
有人知道现有的解决方案会根据高度而不是项目编号对内容进行分页吗?理想情况下,它将是一种解决方案,可以在标记内拆分内容,例如跨多个页面的长段落.
我在下面列出了一些虚拟代码.或者,可以在此处访问代码: 示例,代码
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<style type="text/css" media="screen">
body {background-color:white; font:16px Helvetica, Arial; color:black;}
.pagination {margin:auto; display:block; height:275px; width:300px; position:relative; overflow:hidden; border:1px solid black;}
</style>
</head>
<body>
<div class="pagination">
<p>The House of Representatives shall be composed of Members chosen every second Year by the People of the several States, and the Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature.</p>
<p>No Person shall be …Run Code Online (Sandbox Code Playgroud)