Answer the question
In order to leave comments, you need to log in
How to implement text hiding (cat, cut) in Javascript?
I liked the implementation of hiding text in VKontakte.
Are there any libraries or ready-made functions for this?
Answer the question
In order to leave comments, you need to log in
In the end, I wrote it myself. If anyone is interested:
widget.onload = function(){
block = document.getElementById('content');
block_height = block.style.height ? block.style.height : block.offsetHeight;
if(block_height > 180){
block.style.maxHeight = '180px';
link = document.getElementById('read-next');
link.style.display = 'inline';
link.onclick = function(){
block.style.maxHeight = '';
link.innerHTML = 'Читать далее...';
link.style.display = 'none';
skyscraper();
return false;
}
}
}
You can see it in work here: www.yandex.ru/?add=157239
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question