Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无滚动分页_Javascript_Jquery_Html_Jquery Pagination - Fatal编程技术网

Javascript 无滚动分页

Javascript 无滚动分页,javascript,jquery,html,jquery-pagination,Javascript,Jquery,Html,Jquery Pagination,我正在尝试使用jquery进行分页。单击“下一步”按钮时,将显示一个内容。在此事件中,内容的第一行和最后一行显示一半,即显示内容的一半。因此,我希望在div边界和内容之间留出空间,以便我们可以看到正确的内容。请帮助我解决此问题 <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"

我正在尝试使用jquery进行分页。单击“下一步”按钮时,将显示一个内容。在此事件中,内容的第一行和最后一行显示一半,即显示内容的一半。因此,我希望在div边界和内容之间留出空间,以便我们可以看到正确的内容。请帮助我解决此问题

  <!DOCTYPE html>
  <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>
 <script>
$(document).ready(function() {
//$('.pagination').children().wrapAll('<div class="content"/>');
$('.next').click(function() {
    var height = 10;
    var current = ($('.content').css('margin-top') || '0px');
    var pag = document.getElementById("page");
    //for(i=0; i<pag.
    $('.content').css('margin-top',current.substring(0,current.length-2) - $('.pagination').height() + 'px');
});
});

function clk()
{
    var idc = document.getElementById("c");
    //console.log(idc);
}

function test()
{
    var idc = document.getElementById("c");
    var tn = idc.childNodes[0];
    var sp = document.createElement("span");
    var range = document.createRange();

    range.selectNode(tn);
    range.surroundContents(sp);

    console.log("test" + sp.offsetTop);

    return false;
}
  </script>
  </head>
  <body>
   <div id="page" class="pagination" style="padding:5px">
<div class="content">
    <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 a Representative who shall not have attained to the Age of twenty five Years, and been seven Years a Citizen of the United States, and who shall not, when elected, be an Inhabitant of that State in which he shall be chosen.</p>
    <p>(Representatives and direct Taxes shall be apportioned among the several States which may be included within this Union, according to their respective Numbers, which shall be determined by adding to the whole Number of free Persons, including those bound to Service for a Term of Years, and excluding Indians not taxed, three fifths of all other Persons.) (The previous sentence in parentheses was modified by the 14th Amendment, section 2.) The actual Enumeration shall be made within three Years after the first Meeting of the <span id="c" onclick="clk()">Congress</span> of the United States, and within every subsequent Term of ten Years, in such Manner as they shall by Law direct. The Number of Representatives shall not exceed one for every thirty Thousand, but each State shall have at Least one Representative; and until such enumeration shall be made, the State of New Hampshire shall be entitled to chuse three, Massachusetts eight, Rhode Island and Providence Plantations one, Connecticut five, New York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland six, Virginia ten, North Carolina five, South Carolina five and Georgia three.</p>
    <p>When vacancies happen in the Representation from any State, the Executive Authority thereof shall issue Writs of Election to fill such Vacancies.</p>
    <p>The House of Representatives shall chuse their Speaker and other Officers; and shall have the sole Power of Impeachment.</p>
</div>
    </div>
     <ul>
     <li>Previous</li>
     <li class="next">Next</li>
<li><a href="" onclick="return test()">Click</a></li>
     </body>
    </html>

正文{背景色:白色;字体:16px Helvetica,Arial;颜色:黑色;}
.pagination{页边距:自动;显示:块;高度:275px;宽度:300px;位置:相对;溢出:隐藏;边框:1px纯黑色;}
$(文档).ready(函数(){
//$('.pagination').children().wrapAll('');
$('.next')。单击(函数(){
var高度=10;
当前变量=($('.content').css('margin-top')| |'0px');
var pag=document.getElementById(“页面”);

//对于(i=0;i首先..为什么同时使用纯javascript和jQuery?只使用jQuery..函数测试()是为检查控制台中的偏移量而编写的。我们仅使用jquery。对我来说,这似乎是一个可滚动的列表,跳转点多于分页。如果要分页,为什么不显示您希望看到的内容,而其余内容则隐藏?访问此。这将对您有所帮助。实际上,我正在显示我希望显示的内容,但不包括顶部和底部线路被切断了