Wilson Page

Front-end developer at FT Labs, within the Financial Times. Chatting about JavaScript, CSS, Web-Apps and other goodness. Follow me on Twitter.
  • Contact
  • ask me anything
  • rss
  • archive
  • Exposing module API in CSS

    Lately I have been spending a lot of time investigating reusable view modules. A view is made up of several modules (or components), dropped into certain slots within a layout. The aim is that these modules be fully reusable and transportable. In order for this to work a module must not be aware of its context, and it’s styles must not leak out side of its scope.

    Read More

    • 5 months ago
    0 Comments Tweet
  • CSS 3D transforms messing with your z-index

    About 3D Tranforms

    3D transforms are useful even when you are not creating a design that utilises 3D space. Setting a 3D transform on an element causes hardware accelerated graphics to kick in, making animation super smooth. This is not that evident on powerful desktop platforms but on mobile devices the difference is astonishing!

    To trigger hardware acceleration on an element you can apply a class like this:

    /* Trigger hardware-acceleration */
    .uses3d { -webkit-transform: translate3d(0, 0, 0); -webkit-transform-style: preserve-3d; }
    


    The z-index problem

    I ran into a major issue in particular versions of webkit that causes z-index to be ignored on an element and its children when a 3D property is specified. No matter what I did I could get these particular hardware accelerated elelements to respect their original z-index.


    The fix

    After running round in circles and setting ridiculously high and low z-indexes on elements to no avail I stumbled across the solution. It seemed that within the hardware accelerated layer created z-index was being ignored, so I decided to try setting a pixel value on that “3D” elements z-axis. It worked! In certain browsers (I found Chrome and Blackberry Playbook) the z-index must be reinforced with a z-axis property. Like so:

    #a{
        width: 300px;
        height: 300px;
        background: red;
        position: absolute;
        left: 0px;
        top: 0px;
        z-index: 1;
    
       /* reinforce z-index in 3D space */
        -webkit-transform: translate3d(0, 0, 1px);
    }
    


    Working example

    In this example try commenting out the ‘preserve-3d’ styling on the container and notice how the z-index is respected. With the ‘preserve-3d’ styling on try uncommenting the ‘-webkit-transform’ property on each child element. Notice how styling is preserved. This bug is evident for me on Chrome v16.0.912.75.

    http://jsfiddle.net/qkLWH/20/

    • 1 year ago
    • 8 notes
    • #css
    • #css3
    • #3d tranforms
    8 Comments Tweet
  • Deploying your project using Git

    Part 1


    Part 2

    • 1 year ago
    • 14 notes
    • #git
    • #git hooks
    • #linux
    • #ec2
    • #deployment
    14 Comments Tweet
  • Installing Node.js on your Linux server

    Here I am using the VisionMedia ‘n’ Node Version manager to install the latest version of Node and NPM. Switch to 720p for best quality.

    If you liked my video follow me on Twitter

    • 1 year ago
    • 10 notes
    • #nodejs
    10 Comments Tweet
  • Setting up a new Amazon EC2 instance

    In this video I explain how to setup and Amazon EC2 instance with Linux Ubuntu. I also explain how to SSH into your server using putty.

    • 1 year ago
    0 Comments Tweet
  • Unit testing front-end JavaScript
    • 1 year ago
    0 Comments Tweet
  • [javascript] How to test typeof 'Array'
    • 1 year ago
    0 Comments Tweet
  • [templating] Changing the syntax of underscore tempates

    In this example I change the regex pattern in the templateSettings of underscore to match that of a templating engine you may be using on the back-end.

    • 1 year ago
    0 Comments Tweet
  • [jQuery] CSS3 animate() plugin test

    Here is a little experiment using jquery.transition.js demonstrating how the .animate() method can be upgraded to use CSS3 transitions when available.

    • 1 year ago
    0 Comments Tweet
  • Automated deployment of node.js apps
    • 1 year ago
    0 Comments Tweet
© 2011–2013 Wilson Page
Next page
  • Page 1 / 4