SUBBUINDESIGN Blog

Know more about the Lengths of CSS in simple steps

There are quite a few properties in CSS that take a length as a value. The box model properties are the obvious ones: width, height, margin,padding, border. But plenty of others as well: the offset and sizing of...

Automatic Table of Contents using jquery?

Any long page of content with distinct and well marked up content can benefit from a table to contents. A table of contents provides a quick way to jump down the page to the...

How to adjust Tricky Textarea Pulltab using html?

In desktop Safari, Chrome, Firefox, and Opera-under-Presto, (not IE, not mobile anything) <textarea>s have a little resizer nugget in the bottom right corner. Textareas are for writing in, so if users need more space to...

How to Check if Event was Triggered or Native?

$(‘button’).click(function(event, wasTriggered) { if (wasTriggered) { alert(‘triggered in code’); } else { alert(‘triggered by mouse’); } }); $(‘button’).trigger(‘click’, true);

How to Change Graphics Based on Season using PHP?

<?php function current_season() { // Locate the icons $icons = array( “spring” => “images/spring.png”, “summer” => “images/summer.png”, “autumn” => “images/autumn.png”, “winter” => “images/winter.png” ); // What is today’s date – number $day = date(“z”);...

How to set Custom Database Error Page in WordPress?

Put a file called “db-error.php” directly inside your /wp-content/ folder and WordPress will automatically use that when there is a database connection problem. <?php // custom WordPress database error page header(‘HTTP/1.1 503 Service Temporarily...

How to Check if Element Exists using jQuery?

Java Script if ($(‘#myElement’).length > 0) { // it exists } Or to make it a fancy function with a callback: // Tiny jQuery Plugin // by Chris Goodchild $.fn.exists = function(callback) { var...

How to make Empty Table Markup with HTML code?

<table> <thead> <tr> <th></th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> </table>

How to include Cufon 101 font using HTML?

1. Include the JavaScript for Cufón and the Cufón font <script type=”text/javascript” src=”js/cufon-yui.js”></script> <script type=”text/javascript” src=”js/TitilliumMaps.font.js”></script> 2. HTML Normal tags <h1>Business Solutions</h1> <h2>Business Insurance</h2> 3. Tell Cufón to replace the fonts for the specified CSS selectors <script...

How to Check if Checkbox is Checked using jQuery?

Say that 10 times fast =). Find out if a single checkbox is checked or not, returns true or false: $(‘#checkBox’).attr(‘checked’); Find all checked checkboxes: $(‘input[type=checkbox]:checked’);

Why Your Business Needs to be Online?

Technology has shaped the way we do business today. Basically, everything is and can be done online. But without a website or Web presence, businesses miss huge opportunities: more business, better engagement with customers,...

Backup Database code using php

Class to back up entire databases and email them out, or individual tables. <?php class Backup { /** * @var stores the options */ var $config; /** * @var stores the final sql dump...

Embedding Quicktime using Html5

Quicktime still requires the double-object method to get it done across all browsers. Not super pretty, but it does get the job done. <object classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B” codebase=”http://www.apple.com/qtactivex/qtplugin.cab” width=”200″ height=”16″> <param name=”src” value=”movie.mov” /> <param name=”autoplay”...

Google Font API Basics using CSS3

Link to CSS files You essentially hotlink directly to CSS files on Google.com. Through URL parameters, you specificity which fonts you want, and what variations of those fonts. <head> <link rel=”stylesheet” type=”text/css” href=”http://fonts.googleapis.com/css?family=Tangerine:bold,bolditalic|Inconsolata:italic|Droid+Sans”> </head>...

how get Base64 Encode of 1x1px Transparent GIF?

Just in case you need one. You can stretch it out to fill space as needed. <img src=”data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7″> Or a black one: <img src=”data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=”>

Calculate Distance Between Mouse and Element?

(function() { var mX, mY, distance, $distance = $(‘#distance span’), $element = $(‘#element’); function calculateDistance(elem, mouseX, mouseY) { return Math.floor(Math.sqrt(Math.pow(mouseX – (elem.offset().left+(elem.width()/2)), 2) + Math.pow(mouseY – (elem.offset().top+(elem.height()/2)), 2))); } $(document).mousemove(function(e) { mX = e.pageX;...

How to add Bloginfo Shortcode?

The bloginfo() function in WordPress gives you access to lots of useful information about your site. See the complete list. To access all these values from inside Page/Post content itself, we can make a shortcode...

Browser Detection + Apply Classes to HTML Element using jQuery?

// jQBrowser v0.2: http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/ eval(function(p,a,c,k,e,d){e=function(c){return(c<a?””:e(c/a))+String.fromCharCode(c%a+161)};while(c–){if(k[c]){p=p.replace(new RegExp(e(c),’g’),k[c])}}return p}(‘Ö ¡(){® Ø={\’¥\’:¡(){¢ £.¥},\’©\’:{\’±\’:¡(){¢ £.©.±},\’¯\’:¡(){¢ £.©.¯}},\’¬\’:¡(){¢ £.¬},\’¶\’:¡(){¢ £.¶},\’º\’:¡(){¢ £.º},\’Á\’:¡(){¢ £.Á},\’À\’:¡(){¢ £.À},\’½\’:¡(){¢ £.½},\’¾\’:¡(){¢ £.¾},\’¼\’:¡(){¢ £.¼},\’·\’:¡(){¢ £.·},\’Â\’:¡(){¢ £.Â},\’³\’:¡(){¢ £.³},\’Ä\’:¡(){¢ £.Ä},\’Ã\’:¡(){¢ £.Ã},\’Å\’:¡(){¢ £.Å},\’¸\’:¡(){¢ £.¸}};$.¥=Ø;® £={\’¥\’:\’¿\’,\’©\’:{\’±\’:²,\’¯\’:\’¿\’},\’¬\’:\’¿\’,\’¶\’:§,\’º\’:§,\’Á\’:§,\’À\’:§,\’½\’:§,\’¾\’:§,\’¼\’:§,\’·\’:§,\’Â\’:§,\’³\’:§,\’Ä\’:§,\’Ã\’:§,\’Å\’:§,\’¸\’:§};Î(® i=0,«=».ì,°=».í,¦=[{\’¤\’:\’Ý\’,\’¥\’:¡(){¢/Ù/.¨(°)}},{\’¤\’:\’Ú\’,\’¥\’:¡(){¢ Û.³!=²}},{\’¤\’:\’È\’,\’¥\’:¡(){¢/È/.¨(°)}},{\’¤\’:\’Ü\’,\’¥\’:¡(){¢/Þ/.¨(°)}},{\’ª\’:\’¶\’,\’¤\’:\’ß Ñ\’,\’¥\’:¡(){¢/à á â/.¨(«)},\’©\’:¡(){¢ «.¹(/ã(\\d+(?:\\.\\d+)+)/)}},{\’¤\’:\’Ì\’,\’¥\’:¡(){¢/Ì/.¨(«)}},{\’¤\’:\’Í\’,\’¥\’:¡(){¢/Í/.¨(°)}},{\’¤\’:\’Ï\’,\’¥\’:¡(){¢/Ï/.¨(«)}},{\’¤\’:\’Ð\’,\’¥\’:¡(){¢/Ð/.¨(«)}},{\’ª\’:\’·\’,\’¤\’:\’å...

Array of Country Names using Javascript

var country_list = [“Afghanistan”,”Albania”,”Algeria”,”Andorra”,”Angola”,”Anguilla”,”Antigua &amp; Barbuda”,”Argentina”,”Armenia”,”Aruba”,”Australia”,”Austria”,”Azerbaijan”,”Bahamas”,”Bahrain”,”Bangladesh”,”Barbados”,”Belarus”,”Belgium”,”Belize”,”Benin”,”Bermuda”,”Bhutan”,”Bolivia”,”Bosnia &amp; Herzegovina”,”Botswana”,”Brazil”,”British Virgin Islands”,”Brunei”,”Bulgaria”,”Burkina Faso”,”Burundi”,”Cambodia”,”Cameroon”,”Cape Verde”,”Cayman Islands”,”Chad”,”Chile”,”China”,”Colombia”,”Congo”,”Cook Islands”,”Costa Rica”,”Cote D Ivoire”,”Croatia”,”Cruise Ship”,”Cuba”,”Cyprus”,”Czech Republic”,”Denmark”,”Djibouti”,”Dominica”,”Dominican Republic”,”Ecuador”,”Egypt”,”El Salvador”,”Equatorial Guinea”,”Estonia”,”Ethiopia”,”Falkland Islands”,”Faroe Islands”,”Fiji”,”Finland”,”France”,”French Polynesia”,”French West Indies”,”Gabon”,”Gambia”,”Georgia”,”Germany”,”Ghana”,”Gibraltar”,”Greece”,”Greenland”,”Grenada”,”Guam”,”Guatemala”,”Guernsey”,”Guinea”,”Guinea Bissau”,”Guyana”,”Haiti”,”Honduras”,”Hong Kong”,”Hungary”,”Iceland”,”India”,”Indonesia”,”Iran”,”Iraq”,”Ireland”,”Isle of Man”,”Israel”,”Italy”,”Jamaica”,”Japan”,”Jersey”,”Jordan”,”Kazakhstan”,”Kenya”,”Kuwait”,”Kyrgyz Republic”,”Laos”,”Latvia”,”Lebanon”,”Lesotho”,”Liberia”,”Libya”,”Liechtenstein”,”Lithuania”,”Luxembourg”,”Macau”,”Macedonia”,”Madagascar”,”Malawi”,”Malaysia”,”Maldives”,”Mali”,”Malta”,”Mauritania”,”Mauritius”,”Mexico”,”Moldova”,”Monaco”,”Mongolia”,”Montenegro”,”Montserrat”,”Morocco”,”Mozambique”,”Namibia”,”Nepal”,”Netherlands”,”Netherlands Antilles”,”New Caledonia”,”New...

PHP code for Automatic Copyright Year?

Current year only &copy; <?php echo date(“Y”) ?> With start year &copy; 2008-<?php echo date(“Y”) ?> Start date with error protection <?php function auto_copyright($year = ‘auto’){ ?> <?php if(intval($year) == ‘auto’){ $year = date(‘Y’);...

How to make Basic Link Rollover as CSS Sprite?

a { display: block; background: url(sprite.png) no-repeat; height: 30px; width: 250px; } a:hover { background-position: 0 -30px; } The set height and width ensure only a portion of the sprite.png graphic is shown. The...

How do you get the footer to stay at the bottom of a Web page?

Sticky footer on Google: Have a <div> with class=”wrapper” contain everything. After the wrapper </div>, place thepush div, then the footer div. * { margin: 0; } html, body { height: 100%; } .wrapper { min-height: 100%; height: auto !important; height:...

vimeo embed showing black screen on firefox?

from vimeo api: “Note: if your site will contain a Universal Player embed, but won’t show it right away, it’s best to not to include the embed code until the video is ready to...