Link | string_truncate_fade |
Author | Johan Solve |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 24 Jun 2009 |
Updated | 24 Jun 2009 |
More by this author... |
Fades out a string if it is too long, just as the address bar in Safari 4. Works best for black text on a white background, adjust the colors to use it on other backgrounds.
string_truncate_fade('Too long string that needs to be truncated in a smooth way', 54);
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag('string_truncate_fade',
-required='string', -type='string',
-required='length', -type='integer',
-encodenone);
#string -> size <= #length ? return(#string);
local('output'=#string -> substring(1,#length),
'pos'=integer,
'colors'=array('#666', '#999', '#bbb', '#ddd'));
// create fadeout
loop(4);
#pos=(#output -> size) - (4 - loop_count);
#output=string_insert(#output,
-position=#pos,
-text=(loop_count > 1 ? '')
+ '');
/loop;
#output += '';
return(#output);
/define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft