Scott Gale Scott N. Gale
Vermont
Scott Gale's RSS Feed Scott Gale's LinkedIn Page Scott Gale's Facebook Page Scott Gale's Twitter Page

Archive for the ‘Tech’ Category

Coverflow using CSS 3D Transforms

May 24th, 2011 - by Scott Gale - Add Comment »

As HTML5 and CSS3 technology grows, WebKit CSS 3D transforms are emerging and allowing web developers to do some great things within the browser. To exemplify this, I’ve put together a CSS coverflow demo that functions inside the browser using CSS 3D transformations, reflections, multiple background attachments, and touch events.

View the Demo (best in Chrome or Safari)CSS Coverflow 3D Transforms for WebKit

This works on the iPad and iPhone as well using gestures, swipe left to right or right to left to change the item. This example uses Paul Bakus’ code as a base and building it out with lots of new tech.

Here is the step by step on how I built it.

Step 1: Create Perspective

To build the CSS 3D transform you have to first find your wrapping div and add -webkit-perspective: 500px; to it. For this I used the “bd2″ class wrapper.

.coverflow .bd2 {
   -webkit-perspective: 500px;
   margin: 0;
   height: 60%;
   border: none;
   overflow: hidden;
   width: 100%;
   position: relative;
}

The perspective gives the illusion of depth on the z axis.

Step 2: Apply the CSS 3D Transform
Then apply the CSS 3D transform rotation depending on the location of the image:
var webTransform = "rotateY("+(side === "right"? 55 : -55 )+"deg)";

When the transform is applied it uses the perspective to calculate how much movement is required. You can play with this by expanding and contracting the window to see how the browser deals with it. The perspective code is very important, your rotation won’t work without you defining it.

Step 3: Enhance the view with the reflection
To do the reflect was pretty simple. I used the -webkit-box-reflect with a transparent gradient so that it would fade the reflect out. Here is the code:

.coverflow .hproduct img {
   -webkit-box-reflect:
      below 0px
      -webkit-gradient(linear, left top, left bottom,
         from( transparent ), color-stop(0.5, transparent),
         to( rgba(50,50,50,0.7) )
}

You also have to make sure that your containing div is tall enough to pick up the reflect. I placed some webkit specific code in there because for other browser’s it doesn’t need to be as tall.

@media screen and (-webkit-min-device-pixel-ratio:0) {
   .hproducts .hproduct {
      height:225px;
   }
}

Note: All subsequent steps are extra enhancements to make the coverflow that much better.

Step 4: Allow for scaling
There are a few cool tricks I used to make this allow for scaling. By using multiple background attachments I was able to allow for the slider to scale as the window size changes. Here is the example:

.coverflow .slider {
   position: absolute;
   bottom: 5px;
   left:0;
   margin:0 10%;
   width: 80%;
   height: 19px;
   background: url(files/scrollbar-left.png) no-repeat top left,
            url(files/scrollbar-right.png) no-repeat top right,
            url(files/scrollbar-center.png) repeat-x;
}

I also put a width of 100% on the containing div to allow for it to scale.

Step 5: Capturing the touch gestures
I attempted to use jswipe for this to no avail. So, my solution was to attach a couple events and code this without the help of a plugin. The key to this is 3 events: touchstart, touchmove, touchend. Here is how I utilized these:

document.ontouchend = function() {
   //swipe left
   if( self.swipeLeft && self.swipe ) {
      self.moveTo(self.current-1);
      $("div.slider").slider("moveTo", self.current, null, true);               
   //swipe right
   } else if(self.swipe) {
      self.moveTo(self.current+1);
      $("div.slider").slider("moveTo", self.current, null, true);
   }            
}

document.ontouchmove = function(e){
   //move only if you swipe across
   if( Math.abs(e.touches[0].pageX - self.startX) > 150 ) {
      if( (e.touches[0].pageX - self.startX) > 5 ) {
         self.swipeLeft = true
      } else {
         self.swipeLeft = false;
      }
      self.swipe = true;
   }
}

document.ontouchstart = function(e) {
   self.startX = e.touches[0].pageX;
   self.swipe = false;
}

Basically this detects the range of your swipe and if it is from left to right large than 150 pixels it moves the images accordingly. The ontouchend can be replaced with any function to perform the needed action. The W3C has recently posted a link for touch events here: http://www.w3.org/TR/touch-events/

Step 6: Deal with all the other browsers
Believe it or not, not every browser is equal, so to build out this I used the philosophy of progressive enhancement.

So here are some samples based on what features you have:

If you have no JavaScript, you get something similar to this:
CSS Coverflow No JavaScript Fallback

Running IE7, you get something like this:
IE7 CSS Coverflow

Running FF, you get something like this:
FireFox CSS Coverflow Image

Step 7: Rejoice! You made it.
There are a number of great techniques used for this all rolled into one. CSS -webkit-box-reflect, CSS RotateY, multiple background attachments, touchstart, touchmove, touchend, and browser compatibility handling. These are exciting new additions to browser technology. Browsers are evolving to make our tasks as designers and developers easier. It’s an exciting time to be a web developer.

QR Generator

January 20th, 2011 - by Scott Gale - Add Comment »

A QR Code is a two-dimensional code, readable by QR scanners, mobile phones with a camera, and smartphones. Text, Data, and most importantly URLs can be encoded onto these codes. QR codes are growing in popularity.  As I work on a post outlining the features, pitfalls, when to use, and when not to use, I thought it would be worth posting an easy QR generator in case anyone wants to try these out.

For a QR iPhone Reader I use this one: http://itunes.apple.com/us/app/scan/id411206394?mt=8
But if you are looking for a QR reader that has more options, copy to clipboard etc, try: http://itunes.apple.com/us/app/qr-scanner/id377643590?mt=8

Why JavaScript Pop Ups are Evil

January 2nd, 2011 - by Scott Gale - Add Comment »

For over a decade of website design, Pop-Ups have been finding their way onto websites of all kinds. Anything from the giant click here flashing button that pops up a new window to embedded aggressive pop ups with questionable means have forced us users to constantly hit the close button. I have to admit, I have built my share of sites that have embedded pop ups. Why have I done this? Well because I was a party to a project where the client communicator, whether that be the project manager, or just their account representative was unable to steer them away, even though every usability fiber of their being was screaming “Bad Idea!”. Today I arm you with the logic to build a successful argument against why poorly executed pop-ups are not only a bad usability experience but can negatively impact the user experience and quality conversion. And, if you are a client wanting pop-ups or some variant, listen up!

Poor User Experience
Autotrader, Amazon, Google, Zappos why have they all given up the landing page pop-up? It seems obvious doesn’t it? User experience. When a user lands on your site they have a very specific goal in mind. Every site is different, every site has its own set of goals, and its own set of needs that it can fulfill for the user. We know that for many inventory-driven sites, the user will go immediately to inventory and narrow inventory items into manageable chunks.  One user that lands on your site might be looking for the service phone number, while one user might be interested in the BMW 3-Series with the Sport Package. When a user lands on your site, you need to fulfill these needs as quickly as possible. You MUST organize what they see into manageable chunks of information (7 items or less if I had to put a number on it) so that they can get to where they are going with the least amount of resistance. This basic philosophy is what increases conversion and fulfills the overall goals of the site.  This has been proven time and time again.

When pop-ups are used on a landing page as an onLoad event, this throws all these fundamentals right out the window. When you take over the page, or pop-up a layer that forces the user to interact with whatever comes into the forefront you are not satisfying the users needs. It is merely a distraction for over 80% of the people that have a different goal in mind than what you are popping into their face. Yes, if you pop-up, say, a car special, into someone’s face, you will get more leads for that specific special, but at what cost? You will be passing up a much better and more important conversion when a user finds exactly what they are looking for. You are also going to lose a lot more people when they bounce.

Some Stats on Pop Ups and Bounce Rates
So here is the nitty gritty. In March (of 2010) I started tracking the amount of time it takes for users to close pop-ups across thousands of sites that we run at Dealer.com. The result? 7 months has shown that the most common time it takes to close the pop-up is 3 seconds. This is basically (with the load time included) the amount of time it takes for the user to find and click on the close button. We can see from this observation that we are creating a barrier to satisfying the users needs.

Recently I ran a test to prove another hypothesis. That the bounce rate would actually increase when adding a pop-up. I ran the a/b test over the period of a month and found the following:

Test: A/B pop-up
Bounce Rate without the pop up: 28.62%
Bounce Rate with pop up: 31.75%

So we can see that there was a 3.13% increase in the bounce rate while the pop-up was added.

Just Pop-Ups?
You might hear a lot, “well this implementation is different.”. Lots of other proposals occur around taking over the page with an interactive advertisement etc. Remember, these are pop-ups in disguise! In fact, they may be worse because it will take the user longer to find the close button! Take some time and think about the user experience and conversion. Apply the understanding of the stats and the arguments above to come to the right conclusion that benefits everyone.  A great replacement to the pop up is allowing for a promotional area on the site to feature the appropriate item of interest AND MAKE SURE IT LINKS TO SOMETHING.  That way if the user does like what they see, they can click and find more information, but they don’t have to click to close it to get to where they need to go.

Conclusion
Pop-Ups will get you more leads for a specific event at the cost of impacting other conversion areas and impacting the user experience. Do your best to help your client realize this before they make a mistake that will cost them money. As the web developer or project manager you want to make sure that you advise your client to make positive strides toward their online marketing presence.  Don’t be afraid to suggest alternative approaches such as a promotional area on the landing page.  As a client, web developer, project manager, and anyone involved in making an online marketing presence: put the user first and how your site helps them, conversion and great success will follow!

Internet Explorer 6 and the Universal Stylesheet

November 1st, 2010 - by Scott Gale - 1 Comment, Add »

Anyone who has done any website development in the last decade knows the web developers worst enemy.  It’s a browser plagued by security Issues, compatibility problems, poor build efficiency, and slow render times.  It’s a browser that came out 9 years ago but just hasn’t fully gone away.  Yes, you guessed it, it’s Internet Explorer 6.  In this article I will present all the problems and some real solutions for the browser that just won’t die, so that my fellow web developers can present a convincing argument to rid ourselves of the IE6 dependencies once and for all.  By using Google Chrome Frame, serving the Universal Stylesheet, and setting client expectations we can get some real solutions together for moving the web forward.

The Problems
Compatibility
Web Development is surging forward at an incredibly rapid pace.  With the emergence of CSS3 and HTML5 a lot of common older front-end issues have been solved.  Chrome, FireFox, and Internet Explorer are all working to ensure the best compatibility with what the W3C has put forth.  So where is IE6 in all of this?  Nowhere.  There is no support for CSS3 and HTML5, and why should there be?  Microsoft built this browser in 2001, NINE years ago, (thats 200 in internet years.)  So to experience the web as best as we can, we have to move forward.
My old web app only works in IE6
Wow, so you haven’t done any new development in 9 years to correct this?  Yikes first of all.  Statistics show that IE6 usage is higher during the week than the weekend.  Which points to employers still forcing IE6 browser usage on employees.
Efficiency
Time spent for (IE7, IE8, IE9, FF, Chrome, and Mobile) = Time spent for IE6.
Given any web project, it takes a front-end web developer the same amount of time to develop a site for IE7, IE8, IE9, FF, Chrome, and Mobile as it does for JUST IE6.  This is because of the number of incompatibility issues, hacks, wrangling and just general lack of support that IE6 has.  This creates a huge waste of time for all companies attempting to make things look identical in this browser.  It’s time to get rid of this, so we can take the web forward.
Speed
IE6′s rendering engine is so incredibly slow that even the Google Chrome Frame plugin layer, running on top of IE6 executes the loading of the page faster than IE6′s native rendering engine.  This problem is exacerbated further by companies trying to make advanced web techniques work in this ancient rendering engine.

The Solutions
Google Chrome Frame
This doesn’t solve everything, but it is very important that IT professionals take the time to understand how this works, because it is a very mis-understood piece of software.  The only time this plugin runs, is if the website you are browsing has the appropriate meta information that tells the plugin to launch.  So it is a perfect scenario if you are an IT person and you have to have your users running IE6 still.  This is because a user on your network running IE6 will run in IE6 mode until they go to a site that says “launch chrome frame” at which point it will switch over to a much better browser with standards support that doesn’t suffer from all the problems listed above.
Serve the Universal Stylesheet
Andy Clarke has come up with a great solution for IE6′s problems: the Universal Stylesheet.  The universal stylesheet applies a simplified layer to the content so that IE6 renders content quickly.  It slims down the page significantly and allows for pure content.  This works under the principal that content is king and that by allowing for just pure content makes the browsing experience faster and gets the user to where they need to go quick.  In fact, on the sites where I have served the Universal Stylesheet the bounce rate of IE6 vs other browsers has been only a nominal +5% differential.  Andy Clarke’s universal stylesheet info can be found here: For a beautiful web.
Set Client Expectations
Make sure that your client knows up-front that IE6 will not look the same as modern “Grade A” browsers.  It’s a good idea to build this into the contract.  In all cases where I have said this, clients have been ok with this.  If a discussion ensues then I hope that the points I have brought up here help to relay the problems and solutions.  Make sure they understand that IE6′s browser share is low and rapidly decreasing.  IE6 makes up 6% of web traffic.  Over the past year IE6′s browser share has dropped over 40% and continues to fall.

To all website clients out there; Google, Amazon, YouTube, Facebook, have all dropped support in different areas of their systems for IE6.  IE6 is dying, few people use it anymore and fewer still will use it next month.  More and more people are shifting to modern browsers and mobile options with excellent web standards support.  As web developers we are focusing on the now and on the future for you.  Let us do that, and put the past behind us.

To my fellow web developers; It’s time to stand up and rid ourselves of this browser.  This article outlines the necessary steps going forward for how, learn the techniques and use them, lets take the web forward and make our departments and jobs more efficient.