I am trying to execute this code which adds alipis at the end of the text when it overflows:
var pH = $ ('.txt-entries .txt-entries-wrap'); Var p = $ ('.txt-entries .txt-entries-wrapp' '); Var divh = $ ('.txt-entries'). Height (); While ($ (pH) .terhat ()> divh) {$ (p) .text (function (index, text) {return text.replace (/ \ W * \ s (\ S) * $ /, ' .. ');}); }
Optimized with this thread
On many div elements, but when I put it in each loop, it causes the crash. Here is HTML :
& lt; Div class = "txt-block" & gt; & Lt; Div class = "txt-entries" & gt; & Lt; Div class = "txt-entries-wrap" & gt; & Lt; H2 & gt; Home & lt; / H2 & gt; & Lt; P class = "copy" & gt; Household Advertising & lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "cta-aligner" & gt; & Lt; One class = "CTA-2" href = "#" & gt; Advertising & lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "txt-block" & gt; & Lt; Div class = "txt-entries" & gt; & Lt; Div class = "txt-entries-wrap" & gt; & Lt; H2 & gt; Home & lt; / H2 & gt; & Lt; P class = "copy" & gt; Household Advertising & lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "cta-aligner" & gt; & Lt; One class = "CTA-2" href = "#" & gt; Advertising & lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt;
How can I execute it for all .txt-block
elements?
No comments:
Post a Comment