I split the content of the Html (which belongs to the eBook) into several columns using the following steps .
1) I added HTML inside the content inside the container.
<body>
<div id="container">
<div id="content">
BOOK HTML CONTENT
<span id="endMarker"></span>
</div>
</div>
</body>
2) Then I added the CSS style of the content and the container as shown below:
#container {
width: 240px;
overflow: hidden;
background-color: yellow;
}
#content {
position: relative;
height: 30em;
-moz-column-width: 240px;
-webkit-column-width: 240px;
column-width: 240px;
-moz-column-gap: 10px;
-webkit-column-gap: 10px;
column-gap: 10px;
}
Now, I want to find the column number of text (or row) using javascript?
There are more questions about SO that show how to get the column number based on the identifier. In my case there are no identifiers. The only thing that is available is the text (or string), and I need to get the column number by looking at the contents of the Html.
I currently have two “solutions” to get the column number, but they are incomplete.
1) , , window.find(text), , .
2) - <span> . ( ).
columnCount = Math.floor($('#marker').position().left/(columnWidth + columnGap));
, .
, . , . .