Update 'PHP and jQuery - Reduce Long String to Preview Length and Reveal Full Text OnClick.md'
This commit is contained in:
parent
35be5d7968
commit
b4f180878d
|
@ -2,28 +2,25 @@
|
||||||
/*PHP*/
|
/*PHP*/
|
||||||
static function ReduceStringForPreview($text,$size=100)
|
static function ReduceStringForPreview($text,$size=100)
|
||||||
{
|
{
|
||||||
define($reduced,'');
|
define($reduced,'');
|
||||||
if(strlen($text) > $size)
|
if(strlen($text) > $size){
|
||||||
{
|
$reduced .= "
|
||||||
$reduced .= "
|
". substr($text, 0, $size);
|
||||||
|
$remaining = substr($text, $size);
|
||||||
". substr($text, 0, $size);
|
$reduced .= "...
|
||||||
$remaining = substr($text, $size);
|
";
|
||||||
$reduced .= "...
|
$text = $reduced;
|
||||||
|
}
|
||||||
";
|
return $text;
|
||||||
$text = $reduced;
|
|
||||||
}
|
|
||||||
return $text;
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
/*jQuery*/
|
/*jQuery*/
|
||||||
$(".preview_releaser").click(function(){
|
$(".preview_releaser").click(function(){
|
||||||
$(this).children('span').toggle('fast',function(){
|
$(this).children('span').toggle('fast',function(){
|
||||||
if($(this).css('display') == 'inline-block'){
|
if($(this).css('display') == 'inline-block'){
|
||||||
$(this).css('display','inline');
|
$(this).css('display','inline');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
Loading…
Reference in New Issue