Showing posts from November, 2010

JQuery filesize plugin

Converting raw bytes size into human readable string is a very frequently used task.

I developed a plugin that converts raw bytes into KB or MB and its usage is very simple.

Suppose if you want to show 1000 bytes in human readable form inside a span assign the value as size attribute

<span class="jqfilesize" size="1000"></span>

and use jQuery(".jqfilesize").filesize();

output will be <span class="jqfilesize" size="1000">1 KB</span>

Download the plugin here

Ellipsis class that works in almost all browsers

Applying ellipsis class will put three dots at the end of single line of the content.
Remember that it works only for block elements.

.ellipsis {
white-space: nowrap;

and ellipsos-xbl.xml is required for firefox