
Let's have a quick check on the actual implementation: This leads to the nice visual parallax effect. This means that the image will stay visually on the same position no matter how much scrolling will be done. fixed defines that the background image position is not fixed to the depending element but rather fixed to the viewport. It gets interesting by setting the background-attachment to fixed. The user scrolls on a website and elements are moving up and down and so do the background images. There is nothing fancy about that and we all know this behavior. The initial value of the property is scroll, which basically means that the image position is fixed to its element.

By defining background-attachment the behavior and positioning of any background image can be changed. These elements additionally need to have defined background-attachment: fixed.

To get this parallax effect, background images have to be placed on different elements. See the Pen Parallax with background-attachment : fixed by Stefan Judis ( on CodePen. What only a few people may know, is that this effect can be achieved via CSS, too. In short: parallax done with JavaScript can decrease the scrolling performance of a website quite quickly. To move the mentioned layers, background positions of images get calculated and set to the depending elements, which then additionally causes a lot of DOM manipulations. This leads to tons of events being handled via JavaScript (handling the scroll event can easily cause performance issues and should be considered carefully). These plugins mostly attach an event handler to the scroll event of the window object. Doing this unfortunately has a few disadvantages. In web design, the most common way to achieve this is by simply adding a jQuery plugin to a website. This leads to a nice optical effect and keeps the attention of the visitor. In case you have not heard of this effect, it basically includes different layers of images that are moving in different directions or with different speed.

Enjoy! Introductionįor quite a long time now websites with the so called "parallax" effect have been really popular. The following is a post principally written by Stefan Judis with detail added by myself. They've employed this technique in a few of their features now and I've been so impressed that I implored my readers to write about how it's done. The content itself was great but their use of parallax and imagery was outstanding. I generally dislike ESPN because they're the McDonalds of sports news but they recently did a piece on Luis Suarez that was eye-catching.
