PublicPosts/PHP and jQuery - Reduce Lon...

29 lines
459 B
Markdown

```php
/*PHP*/
static function ReduceStringForPreview($text,$size=100)
{
define($reduced,'');
if(strlen($text) > $size)
{
$reduced .= "
". substr($text, 0, $size);
$remaining = substr($text, $size);
$reduced .= "...
";
$text = $reduced;
}
return $text;
}
```
```js
/*jQuery*/
$(".preview_releaser").click(function(){
$(this).children('span').toggle('fast',function(){
if($(this).css('display') == 'inline-block'){
$(this).css('display','inline');
}
});
```