Justin Paul Silva

Web design, development, & more

3D Javascript Effect

Posted on

Here’s a little Javascript effect that will give your site a subtle 3D look by simulating a parallax between the content of your site and the background. Try out the effect now by scrolling up and down on my site. CSS only gives us two choices for background-attachment: scroll (default) and fixed. This script is sort of halfway between the two by making the background scroll half as fast as the content. $(function(){ $("body").css("backgroundAttachment", "fixed"); $(window).scroll(funct ... read on

Calculating Business Days in PHP

Posted on

For one of my client’s projects, The Superdups Self-Service Quoter, I had to write an algorithm to estimate due date of each order based on a selected turn around time in business days. This would probably be a simply task in Ruby on Rails, but unfortunately, that wasn’t an option. The Code class DateHelper { // Holidays must be in order var $holidays = array("2010-07-04", "2010-09-06", "2010-09-23", "2010-10-11", "2010-11-01", "2010-11-11", "2010-11-25", "2010-12-25"); const on ... read on

Syntax Highlighting for Your Blog

Posted on

One of the greatest things about code editors is syntax highlighting. It makes any kind of code or markup language easier to read and understand. So why not use the same highlighting in your <code> blocks on your blog or website? When I created this site (just this week), syntax highlighting was one thing I knew I needed to have. So I did some searching, and it turns out to be incredibly easy to set up. I decided on JavaScript Syntax Highlighter (or JUSH). It’s available as a stand- ... read on

CSS Trick: Body Width

Posted on

What do you do when you want your page’s content centered, but everything floated at the same time, such as when using a grid-based CSS framework like Blueprint or the 960 Grid System? There are two ways to do this. The first is the margin:auto; method. ... <body> <div id='header'> ... </div> <div id='content'> ... </div> <div id='footer'> ... </div> </body> body > * { width:960px; margin:auto; } But what if you have several ... read on