Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide part view text in overflow hidden

I making bookReader and one page will fit to user viewport. For this approach i make div

<div id="book">Long text...</div>

with

#book { 
    overflow: hidden
} 

Then i provide to scroll this element only with buttons next and prev. When user click next button it will scroll like this

$('#next').on('click',function(){
    $('#book').scrollTop($('#book').scrollTop() +  $('#book').height());
});

But i have problem. That some times user will see part of text-line. How can i check every page is that last text-line is shown broken, and hide them if him is broken. I don't want to change content. I need a function that will check every page if that contains that part text and if this have that part text, hide him by making on the top element that should hide that.

DEMO: I show in red color what i need find and hide.

http://jsfiddle.net/lvivgeorge/jd7mum6c/3/

DEMO 2: It can contains anything (header tags, img, <code> , etc.) http://jsfiddle.net/lvivgeorge/jd7mum6c/12/

P.S. Make all the same line-height is not solution. Change content styles is not solution too.

like image 614
georgelviv Avatar asked Dec 22 '14 09:12

georgelviv


People also ask

What is the difference between Overflow hidden and visible in Python?

The overflow:hidden; declaration hides any text that would otherwise extend past the right side of the container. The text-overflow:ellipsis; declaration prints an elipsis where some of the text is clipped. The overflow:visible; declaration makes the entire line visible when the mouse pointer hovers over the line.

How do I hide overflow on a div block?

To make sure the animation still functions as you had intended, you can remove Overflow: hidden on the Div block and instead set Overflow: hidden on the next parent up in the element hierarchy — the Section: Select the Heading’s parent element (e.g., “Hero container” Div block) Select the next parent up in the hierarchy (e.g., “Hero Section”)

What does overflow hidden mean in a text file?

This topic is empty. Overflow:hidden seems to be cutting of the text. That’s what it’s supposed to do: it hides everything that “overflows”.

How to hide overflow text in a cell in Google Sheets?

In the Format Cells window Alignment tab, (1) choose Fill for Horizontal text alignment, and (2) click OK. As a result, the text in cell B2 is cut off to fit the cell height and is no longer overflowed to the other cells. Hide Overflow Text in a Cell in Google Sheets


1 Answers

IMHO You should set fixed line-height of each text line, and set container height fixed as a multiple height of each textline. This should helps

Check this out: http://jsfiddle.net/jd7mum6c/5/

like image 144
Michał Kutra Avatar answered Sep 23 '22 01:09

Michał Kutra