javascript Programming Glossary: posstart
Truncate a string nicely to fit within a given pixel width http://stackoverflow.com/questions/282758/truncate-a-string-nicely-to-fit-within-a-given-pixel-width fit span.innerHTML result if span.offsetWidth len var posStart 0 posMid posEnd str.length while true Calculate the middle position.. str.length while true Calculate the middle position posMid posStart Math.ceil posEnd posStart 2 Break the loop if this is the last.. the middle position posMid posStart Math.ceil posEnd posStart 2 Break the loop if this is the last round if posMid posEnd..
|