Posted on September 26, 2011, 8:03 am, by Brian, under
Uncategorized.
Firebug is a great way to debug during web page development. Although it is not available natively in IE it can be easily added by pasting in the code below in the address bar of the page you want to use it.
javascript:var firebug=document.createElement(’script’);firebug.setAttribute(’src’,'http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js’);document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);
Needed a quick way to add leading zeros to numbers for a js countdown script. Not hard to do, now I can look at this post for the code when I need it again.
function addLeadingZeros(n, totalDigits)
{
if(!totalDigits)totalDigits = 2;
n = String(n);
while (n.length < totalDigits)
n [...]
Vimeo does not (at the time of this writing) have an iPhone/Pad version of their embed code. After seeing this solution , I had a need to do something similar but with all Vimeo embeds sitewide.
jQuery to the rescue and must be included for this to work – best used in a dom ready event.
[...]
Sometimes Youtube or other embeds may not work in a given site layout.
Here is a bit of jQuery that loops over each object or embed tag and sizes them according to a maximum width, while respecting the aspect ratio.
Since this is a javascript solution, a visitor must have js enabled for the resizing to [...]