根据行号对html div进行分割,即每个具有固定高度的div有10行,然后使用jquery进行分页以读取div的下一个



我想根据行数划分div,并对div执行分页操作。div的样式和对齐方式应该保持不变。有一个约束条件是div的高度是固定的。

$.fn.numLines = function() {
    var tmp = $('<div style="visibility:hidden;">x</div>').appendTo(document.body);
    var lines = this.height() / tmp.height();
    tmp.remove();
    return lines;
};
$('#change').keyup(function() {
    $('#test').html(this.value.replace(/n/g, '<br />'));
    $('#lines').text($('#test').numLines());
}).keyup();
#test {
    border: 1px solid #000;   
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
lines: <div id="lines"></div>
<br />
<div id="test"></div>
<br />
<textarea id="change" rows="10" cols="40">
<div id="target" class='holder-description'>
    <table style="width:100%"><tbody><tr><td style="width:45%">NS 1 DENGUE ANTIGEN</td><td style="width:19%">negative</td><td style="width:18%"></td><td style="width:18%"></td></tr></tbody></table><p><span style="font-family: Arial; font-size: 13px;">COMMENTS:</span></p>
<p><span style="font-family: Arial; font-size: 13px;"></span><span style="font-family: Arial; font-size: 13px;">Accurate and timely diagnosis of dengue virus is important for early detection of dengue virus infection. In this study, the usefulness of the dengue NS1 antigen test was evaluated as a routine, rapid diagnostic test for dengue virus infection. A total of 208 sera from patients suspected of having dengue virus infection were collected and tested for dengue antibody, dengue genome and dengue NS1 antigen. Dengue antibody test, dengue PCR test and dengue antigen test were able to detect dengue virus infection from Days 1 to 8 in 72.8, 52.8 and 44.0% of samples, respectively. Of the 208 sera tested, 69.2% (144/208) of the acute sera were positive for dengue virus infection based on IgM antibody, IgG antibody, NS1 antigen and PCR tests. Thirty-two point two percent of the samples (67/208) were found positive for dengue NS1 antigen, 38.5% (80/208) were PCR positive, 40.9% (85/208) were IgM positive and 36.1% (75/208) were IgG positive for dengue virus. The results reveal the detection rate of dengue virus infection was similar for PCR and dengue antibody (65.9%) and for NS1 antigen and dengue antibody (62.0%) combinations. Therefore, the dengue NS1 antigen test can be used to complement the current antibody test used in peripheral laboratories. Thus, the combination of the NS1 antigen and antibody tests could increase the diagnostic efficiency for early diagnosis of dengue infection.</span></p><table style="width:100%"><tbody><tr><td style="width:45%">DENGUE IgG</td><td style="width:19%">negative</td><td style="width:18%"></td><td style="width:18%"></td></tr></tbody></table>COMMENTS:<br>
<br>
The presence of three pink coloured line indicate the presence of specific Igm &amp; IgG antiboidies against virus. The presence of of two pink coloured line one test line Igm within test zone closer to the sample well &amp; one conrol line in control zone indicate presence of IgM antibodies against dengue virus. The presence of two pink coloured line one test line IgG within test zone closer to control zone or away from sample zone and one control line in control zone indicate presence of IgG antibodies against Dengue virus.<br>
In primary dengue fever IgM antibodies can be detedtes as early as 3-5 days after the fever, where as IgG antibodies are negative. In secondary Dengue fever IgG antibodies are positive &amp; IgM antibodies may be also be positive secondary dengue fever is a second infection with same or different sero type and is often associated with the complication as dengue haemorrhagic fever and dengue shock syndrome.<br>
A few patients of Dengue fever may not produce detectable levels of antibodies within 7-10 days after infection and test result may show negative for antibodies . If symptoms persist a retest after 5-7 days is recommented.<br>
The serological cross reactivity across the Flavi virus group is commom i.e. between dengue 1,2,3,4, murray valley encephalitis, japnese encephalitis and yellow virus.<br><table style="width:100%"><tbody><tr><td style="width:45%">DENGUE IgM</td><td style="width:19%">negative</td><td style="width:18%"></td><td style="width:18%"></td></tr></tbody></table>COMMENTS:<br>
This test determines simultaneously for the presence of IgM and IgG antibodies to Dengue virus. The total is panreactive to Dengue viruses 1,2,3 and 4. Serum IgM antibodies can be detected as early as three to five days after the onset of fever and generally persist for 30 to 90 days. It may be detected as long as eight months post-infection.Secondary infection is characterized by high IgG antibody levels and may be accompanied by elevated IgM levels.<br>
<br>
Primary Dengue: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IgM detected<br>
<br>
Secondary Dengue:Both &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IgM &amp; IgG detected<br>
<br>
Secondary Dengue suspected : &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IgG Detected<br>
<br>
Negative: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IgM &amp; IgG not detected<br><div style="text-align:center;"> *****EOR****<br>Powered by cloudchowk</div></div>
</textarea>

使用em CSS单元;

在CSS中,有许多度量单位,其中两个在您的情况下非常有用。

em:相对于元素的字体大小(2em表示当前字体大小的2倍)。。。

你可以在w3schools.com的文章上阅读更多关于这些单元的信息

在你的情况下,<div style="height:10em;">...<div>是一条路。。。

最新更新