Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Przycinanie za dlugiego tekstu wielokropkiem, Ktos wie jak to zrobic
Orzeszekk
post
Post #1





Grupa: Zarejestrowani
Postów: 260
Pomógł: 14
Dołączył: 8.09.2011

Ostrzeżenie: (0%)
-----


Chcialbym po stronie CSS (ewentualnie, ale to bardzo ewentualnie jakis gotowy untrobusive javascript) przyciąć tekst ktory mi sie w newsach nie miesci.

Chcialbym zeby to co sie nie zmiescilo zostalo uciete i zeby dopisalo wielokropek.

jest text-overflow: ellipsis ale on dziala tylko dla jednej linijki tekstu a ja mam całe bloki. bardzo proszę o pomoc.


--------------------
"The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time."
Tom Cargill, Bell Labs
Go to the top of the page
+Quote Post
prowseed
post
Post #2





Grupa: Zarejestrowani
Postów: 433
Pomógł: 64
Dołączył: 29.01.2011
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


moze tak?
http://www.jeremymartin.name/projects.php?project=jTruncate

//EDIT
ew. jesli chcesz po prostu przyciac, to moze po prostu tak:
  1. <script type="text/javascript">
  2. var shortText = $("#content").text() // get the text within the div
  3. .trim() // remove leading and trailing spaces
  4. .substring(0, 600) // get first 600 characters
  5. .split(" ") // separate characters into an array of words
  6. .slice(0, -1) // remove the last full or partial word
  7. .join(" ") + "..."; // combine into a single string and append "..."

źródło: http://stackoverflow.com/questions/2248742...read-more-style

Jezeli nie odpowiada Ci jq, to po prostu atakuj google ze slowem javascript truncate

Ten post edytował prowseed 15.04.2012, 11:00:27


--------------------
Go to the top of the page
+Quote Post
Niktoś
post
Post #3





Grupa: Zarejestrowani
Postów: 1 195
Pomógł: 109
Dołączył: 3.11.2011

Ostrzeżenie: (10%)
X----


Fajnie to wygląda ,ciekawe czy da to rade z bbcode np.<br />.
  1. <div>długi tekst<br />długi tekst</div>
-czyli czy to bierze kwestie przełamania linii?Zależy co orzeszkkowi potrzebne.

Ten post edytował Niktoś 15.04.2012, 10:58:31
Go to the top of the page
+Quote Post
Orzeszekk
post
Post #4





Grupa: Zarejestrowani
Postów: 260
Pomógł: 14
Dołączył: 8.09.2011

Ostrzeżenie: (0%)
-----


nom poradzilem sobie w koncu javascriptem daje rade, dzieki:)


--------------------
"The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time."
Tom Cargill, Bell Labs
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 11:19