Try Tuts+ Premium, Get Cash Back!
Create a Parallax Scrolling Website Using Stellar.js

Create a Parallax Scrolling Website Using Stellar.js

Tutorial Details
  • Topic: Parallax UI
  • Difficulty: Intermediate

Final Product What You'll Be Creating

One of the biggest trends in recent modern web design is use of parallax scrolling effects. In this tutorial I’m going to show you how you can create the effect on your own website, with a bit of imagination and a little help from Stellar.js.


Introduction

The parallax scrolling effect has been popular ever since sites such as Nike’s Better World introduced it on their websites a few years ago. The parallax effect with regard to interfaces has been around since the 1980′s when it was first used in video game titles and subsequently in games themselves. More recently it started to make an appearance in web interfaces – you’ll be familiar with silverbackapp which used the effect as part of the header.

When combined with the scrolling functionality of a website, parallax scrolling effects can have a strong visual impact, especially when combined with some form of story which takes you on a journey.


Para…What?

Parallax is a displacement or difference in the apparent position of an object viewed along two different lines of sight. – Wikipedia

So what exactly is the parallax effect? Well it’s probably one of the things that your clients refer to when they blindly say “I want my site HTML5″. Whenever clients ask me for an “HTML5″ site, I have to ask them specifically how they interpret the meaning HTML5 – at the moment it just seems to be the buzzword that clients keep saying to me without really understanding what it means.

So is it HTML5? Sure HTML5 does have a part to play in the parallax scrolling effect but it’s more than HTML5, it also utilizes some form of javascript, such as jQuery, and wouldn’t be possible without a little bit of CSS3.

The actual word parallax is derived from the Greek παραλλαξη (parallaxis) which means alteration. Objects which are closer to the eye have a larger parallax than objects which are in the distance. This means that objects which are closer to us can appear to move faster than objects in the background.

Layering up multiple backgrounds and objects (such as images) and then allowing them to move at different speeds creates a sensation of depth and dimension.


Parallax in Action

Take a look at some examples which demonstrate parallax effects.

Saucony
Lois Jeans
Nike Jump man
Bomb girls
Tokiolab
Intacto

Every Website Tells a Story

The examples above all take you on some form of journey or story, and they do so in a variety of different ways. This, in my opinion, is what makes a parallax scrolling site a success. The key to making it interesting and unique is by focussing on a good story and concept, then using the effect in creative and imaginative ways.

Wieden+Kennedy (W&K), the guys behind the Nike Better World Website support this:

In our opinion, technologies are independent of concept. Our primary focus was on creating a great interactive storytelling experience. – Wieden+Kennedy (W&K)


How Our Site Will Work

To demonstrate one way of implementing parallax scrolling into your website I’ve opted to show you a simple four slide website that uses the effect on different backgrounds and images. I’ve also added a navigation in the left hand corner which will scroll to a specific slide on the site and will also change size to reflect the active slide number. I’m also using the web font Bebas, though you’re free to use something else if you wish.

Here’s how our folder structure will appear:

parallax website folder structure

The Plugins Used

Stellar.js

To help me achieve this I’m using the Stellar.js, a jquery plugin by Mark Dalgleish which makes it easy to create parallax scrolling sites. There are other plugins available to help you do this which I’ve listed at the bottom of this article. I’ve opted to use Stellar.js as it’s fairly straightforward to implement and, although not demonstrated during this tutorial, it can be optimized to work on smart device platforms such as iOS.

Waypoints

I’m also going to use jQuery waypoints by Caleb Troughton. Waypoints is another jQuery plugin which executes a function whenever you scroll to an element. This allows the navigation on the site to highlight which slide we are on according to the position of the scrollbar.

jQuery Easing

jQuery easing is a plugin from GSGD which offers advanced easing options. We will be using this to add a nice easing movement when transitioning from slide to slide.


The HTML Markup

Kicking off our index.html we add the HTML5 doctype and then create the head section. This consists of a CSS Reset followed by our style sheet ‘styles.css’. We then add the jQuery library followed by our custom jQuery file ‘js.js’. This is then followed by the three plugins, ‘jquery.stellar.min.js’,'waypoints.min.js’ and ‘jquery.easing.1.3.js’.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Create a parallax Website using Stellar.js</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/jquery.stellar.min.js"></script>
<script type="text/javascript" src="js/waypoints.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
</head>

The next element in our html is the image of the Envato logo which remains in a constant fixed position throughout the whole site. To this we add a class of ‘envatologo’ so that we can set the positioning of it later when we code up the CSS.

<img class="envatologo" src="images/envatologo.png">

The Slides

The four slides use the same markup:

	<div class="slide" id="slide1" data-slide="1" data-stellar-background-ratio="0.5">
		<a class="button" data-slide="2" title=""></a>
	</div><!--End Slide 1-->

We use a class of ‘slide’ that will be used as a general style for all the slides. Each slide is then given an id of ‘slide’ followed by the slide number ie ‘Slide1′. We use the HTML5 data attribute and name it ‘data-slide’. This will allow us to target it using jQuery. Another data attribute of ‘data-stellar-background-ratio’ is added. This is specific to the stellar.js jQuery plugin and tells the plugin at what ratio the speed of the element should scroll.

The ratio is relative to the natural scroll speed, so a ratio of 0.5 would cause the element to scroll at half-speed, a ratio of 1 would have no effect, and a ratio of 2 would cause the element to scroll at twice the speed.

All slides except for slide four have a button that will allow us to scroll to the next slide. To this we add the ‘data-slide’ attribute with the value of the next slide number. This is so the button knows what slide is next so that we can pass this value to jQuery. The majority of the slides also have a span with a class of ‘slideno’; simply a large text version of the slide number which appears in the bottom left hand corner of most slides. This could also be used for titles.

<span class="slideno">Slide 1</span>

On slides three and four we also add some image elements to the ‘slide’ div. These images will give a real insight into the parallax effect that we are creating. We wrap these inside a ‘wrapper’ div that will be centralized and is ’960px’ wide, this is just to ensure that it displays OK across all desktop monitor sizes.

Each image has a ‘data-stellar-ratio’ attribute attached to it. This again is stellar.js specific and tells the plugin at what ratio of speed we should scroll the element at.

<div class="wrapper">
			<img src="images/slide3/freelance.png" data-stellar-ratio="1.4" data-stellar-vertical-offset="-102"alt="">
			<img src="images/slide3/psdtuts.png" data-stellar-ratio="1.5" data-stellar-vertical-offset="-53"alt="">
			<img src="images/slide3/rockable.png" data-stellar-ratio="2.7" data-stellar-vertical-offset="-200"alt="">
			<img src="images/slide3/themeforest.png" data-stellar-ratio="3" data-stellar-vertical-offset="-200"alt="">
			<img src="images/slide3/tutshub.png" data-stellar-ratio="1" data-stellar-vertical-offset="-200"alt="">
			<img src="images/slide3/psdtuts.png" data-stellar-ratio="1.5" data-stellar-vertical-offset="-200"alt="">
</div>

The CSS

Luckily for us there’s not too much involved with the CSS. It’s basically styling a few simple elements, but the majority of it is for positioning some of the image elements.

The first thing we need to do with our CSS is bring in the BEBAS font using @font-face. We then add that to the html to set the font for the site. We also set the width and height of the html and body to 100%. This will allow our slides to adopt the full width and height of the user’s screen.

@font-face {
	font-family: 'BebasRegular';
	src: url('font/BEBAS___-webfont.eot');
	src: url('font/BEBAS___-webfont.eot?#iefix') format('embedded-opentype'),
	url('font/BEBAS___-webfont.woff') format('woff'),
	url('font/BEBAS___-webfont.ttf') format('truetype'),
	url('font/BEBAS___-webfont.svg#BebasRegular') format('svg');
	font-weight: normal;
	font-style: normal;
	}
html,body{
	font-family: 'BebasRegular';
	width:100%;
	height:100%;
}

The Navigation

The main navigation is given a ‘fixed’ position to keep it in the same place throughout the site. We offset this 20px from the top to give a little bit of space above it and set the z-index to 1 to ensure that this is on the top layer of the site.

The actual list is just the styling of the text with a border across the bottom to act as an underline. This has a width of 53px. A transition is also added so that it animates from its standard state to its hover state. I’ve used the -webkit- prefix here just to keep the code short, but the full source code which can be downloaded above contains all vendor prefixes.

The hover state also uses the same properties as the class ‘active’; basically just an increase in font size and width. The ‘active’ class is used by jQuery to style the relevant slide which is in view of the browser window.

.navigation {
	position:fixed;
	z-index:1;
	top:20px;
}
.navigation li {
	color:#333333;
	display:block;
	padding: 0 10px;
	line-height:30px;
	margin-bottom:2px;
	font-weight:bold;
	-webkit-transition: all .2s ease-in-out;
	border-bottom:1px solid black;
	text-align:left;
	width:53px;
}
.navigation li:hover,
.active {
	font-size:25px;
	cursor:pointer;
	width:100px!important;
}

The envato logo is given some positioning styles just to ensure that it remains in the centre of the screen. Similarly to the navigation this is also given a z-index of ’1′ to ensure it stays on top.

.envatologo {
	position:fixed;
	top:50%;
	left:50%;
	width:446px;
	margin-top:-41px;
	margin-left:-223px;
	z-index:1;
}

Now we move onto styling of the actual slides. We give them a background-attachment ‘fixed’ property. The background-attachment property sets whether a background image is fixed or scrolls with the rest of the page, so comes in useful for background-images (such as used on slide four). For this example we’ve used a wallpaper by Philipp Seiffert which can be downloaded here. We set the position of the slide to ‘relative’. This is to that we can absolutely position the classes ‘slideno’ and ‘button’ against the slide as opposed the actual document.

The box shadow is purely for decoration purposes and adds a nice drop shadow to the top inset of each slide.

.slide {
	background-attachment: fixed;
	width:100%;
	height:100%;
	position: relative;
	box-shadow:inset 0px 10px 10px rgba(0,0,0,0.3);
}
.wrapper {
	width:960px;
	height:200px;
	margin:0 auto;
	position:relative;
}
.slideno {
	position:absolute;
	bottom:0px;
	left:0px;
	font-size:100px;
	font-weight:bold;
	color:rgba(255,255,255,0.3);
}

The .button is for the button at the bottom of the page which allows us to progress to the next slide. We’ve positioned it at the bottom centre of each slide and have used an image of an arrow as the indicator.

.button{
	display:block;
	width:50px;
	height:50px;
	position:absolute;
	bottom:0px;
	left:50%;
	background-color:#333333;
	background-image:url(../images/arrow.png);
	background-repeat:no-repeat;
}
.button:hover{
	background-color:#494949;
	cursor:pointer;
}

The styling for each individual slide is relatively simple and follows the same pattern each time. Slide one has a background color of ‘#5c9900′. Slide two also has a background color set on it. Slide two also contains images and we can target each one by using the CSS Selector nth-child(n). This selector can be described as

This pseudo-class matches elements on the basis of their positions within a parent element’s list of child elements.

So we’re basically styling each image in the order they appear in our markup. We’re simply positioning them relative to the wrapper of the slide.

/******************************
 SLIDE 1
*******************************/
#slide1{
	background-color:#5c9900;
}
/******************************
 SLIDE 2
*******************************/
#slide2{
	background-color:#005c99;
}
#slide2 img:first-child{
	position:absolute;
top: 700px;
left: -150px;
}
#slide2 img:nth-child(2){
	position:absolute;
	top:300px;
	left:100px;
}
#slide2 img:nth-child(3){
	position:absolute;
	top:600px;
	left:300px;
}
#slide2 img:nth-child(4){
	position:absolute;
	top:400px;
	left:300px;
}
#slide2 img:nth-child(5){
	position:absolute;
	top:600px;
	right:300px;
}
#slide2 img:nth-child(6){
	position:absolute;
	top:600px;
	right:300px;
}
#slide2 img:nth-child(7){
	position:absolute;
	top:400px;
	right:100px;
}
#slide2 img:nth-child(8){
	position:absolute;
	top:100px;
	right:300px;
}

Slide three follows the same suit as slide two.

/****************************** SLIDE 3 *******************************/
#slide3 {
	background-color:#b6c10b;
}
#slide3 img:first-child {
	position:absolute;
	top: 700px;
	left: 300px;
}
#slide3 img:nth-child(2){
	position:absolute;
	top:100px;
	left:100px;
}
#slide3 img:nth-child(3){
	position:absolute;
	top:150px;
	left:300px;
}
#slide3 img:nth-child(4){
	position:absolute;
	top:450px;
	left:300px;
}
#slide3 img:nth-child(5){
	position:absolute;
	top:200px;
	right:300px;
}
#slide3 img:nth-child(6){
	position:absolute;
	top:100px;
	right:300px;
}

Slide four is slightly different than the previous two slides as it doesn’t contain any image elements or a background-color, but instead uses a background-image. We’ve also given it the CSS3 property ‘background-size:cover’. This basically sets the background-image to cover the entire browser window and will resize as the browser window resizes. We have also added a line of text on the last slide which we have styled and given a class of ‘parallaxbg’

/******************************
 SLIDE 4
*******************************/
#slide4{
	background-image:url(../images/Slide4/desktop4.jpg);
	-webkit-background-size: cover;
	-moz-background-size: cover;
	-o-background-size: cover;
	background-size: cover;
}
#slide4 .parallaxbg{
	position:absolute;
	right:40px;
	top:40px;
	font-size:28px;
	color:rgba(51,51,51,0.3);
}

The jQuery

The jQuery really is where this thing starts to come to life. I’ve commented the code so that you can see exactly what is happening.

jQuery(document).ready(function ($) {
    //initialise Stellar.js
    $(window).stellar();
    //Cache some variables
    var links = $('.navigation').find('li');
    slide = $('.slide');
    button = $('.button');
    mywindow = $(window);
    htmlbody = $('html,body');
    //Setup waypoints plugin
    slide.waypoint(function (event, direction) {
        //cache the variable of the data-slide attribute associated with each slide
        dataslide = $(this).attr('data-slide');
        //If the user scrolls up change the navigation link that has the same data-slide attribute as the slide to active and
        //remove the active class from the previous navigation link
        if (direction === 'down') {
            $('.navigation li[data-slide="' + dataslide + '"]').addClass('active').prev().removeClass('active');
        }
        // else If the user scrolls down change the navigation link that has the same data-slide attribute as the slide to active and
        //remove the active class from the next navigation link
        else {
            $('.navigation li[data-slide="' + dataslide + '"]').addClass('active').next().removeClass('active');
        }
    });
    //waypoints doesnt detect the first slide when user scrolls back up to the top so we add this little bit of code, that removes the class
    //from navigation link slide 2 and adds it to navigation link slide 1.
    mywindow.scroll(function () {
        if (mywindow.scrollTop() == 0) {
            $('.navigation li[data-slide="1"]').addClass('active');
            $('.navigation li[data-slide="2"]').removeClass('active');
        }
    });
    //Create a function that will be passed a slide number and then will scroll to that slide using jquerys animate. The Jquery
    //easing plugin is also used, so we passed in the easing method of 'easeInOutQuint' which is available throught the plugin.
    function goToByScroll(dataslide) {
        htmlbody.animate({
            scrollTop: $('.slide[data-slide="' + dataslide + '"]').offset().top
        }, 2000, 'easeInOutQuint');
    }
    //When the user clicks on the navigation links, get the data-slide attribute value of the link and pass that variable to the goToByScroll function
    links.click(function (e) {
        e.preventDefault();
        dataslide = $(this).attr('data-slide');
        goToByScroll(dataslide);
    });
    //When the user clicks on the button, get the get the data-slide attribute value of the button and pass that variable to the goToByScroll function
    button.click(function (e) {
        e.preventDefault();
        dataslide = $(this).attr('data-slide');
        goToByScroll(dataslide);
    });
});

Just a Few Points

Create a Parallax Scrolling Website using Stellar.js envato

If you look at slide two of our example, you will notice the 3D bubbles. I have added a slight gaussian blur to some of these, mainly to those at the very foreground and background. Combining these with sharply focused bubbles adds to the sense of depth that parallax creates. This is something that you should maybe consider when trying to get good depth to your site.

A lot of sites that utilize this effect do tend to be quite image heavy, make sure you compress your images as much as you can (without sacrificing quality). If after compression it’s still taking quite a while to load then consider adding a loader to your site.


Conclusion

Parallax scrolling is one of the most loved effects of recent times and people are constantly pushing the boundaries with it. Here today I’ve shown you how to setup a basic website that utilizes parallax scrolling. The demo that I’ve shown today is a relatively simple site for learning purposes. For those of you who are about to create a site using this effect then I urge you to spend time on the concept and story as this is what makes them unique, shareable and indeed a pleasure to browse. It’s about how you can utilize this effect wisely and not just using it for the sake of using it.

I hope you’ve enjoyed reading about parallax scrolling and I’d love to see how you guys have utilized it in your own sites, feel free to leave links to them below. Until next time!


Further Links Reading And Resources

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://khaledgarbaya.net Khaled

    Nice work, but it may seem a little bit slow or is it because of the easing in the animation

    • http://twitter.com/mrxxiv Mr.XXIV

      That’s normal. :) Most likely it’s our computer’s performance that lacks high-res animations at full screen.

      Make your browser smaller and you’ll see the difference. :D

    • http://skuda.net skopp

      I don’t know if it’s so much the computer because this is not WebGL (ie. not GPU intensive)… it’s a sort of “spoof” animation. I made one using only 3 png layers, parallax.js, standard html and pure css 3 for dimensioning (no sass, scss, erb etc.).
      I think it’s the Easing.js… you can always speed up the scroll and bump up/down the acceleration as needed I suppose. But what browser are you using because I hear these things are best with webkit browsers…

  • David K. Molnar

    In Google Chrome it’s not perfect. By grabbing the scrollbar with the cursor and scrolling down in this way, before you can reach the last section, it suddenly jumps back to the top.

    • http://www.snaptin.com Ian Yates

      Chrome for Windows? I don’t have any issues with OS X..

    • http://www.aaronlumsden.com Aaron Lumsden
      Author

      I tested this on chrome for windows vista and it seems to work ok. I know that there are some bug issues with chrome and windows 7, so maybe that’s the case.

    • http://kriix.com Kristijan

      Yeah, there are bugs for a longer time (on Windows 8 too) but as it seems the canary build has it already sorted out.

    • David K. Molnar

      Yes, it’s Chrome and Win7.

  • http://www.akkis.gr Akkis

    I am so happy for this tutorial and so proud for being greek :)

    • http://www.snaptin.com Ian Yates

      I wondered when we’d get the first Greek comment :)

      • http://www.lollypop.gr George Drakakis

        Get another one then :-)

  • http://demetriad.co.uk Chris Demetriad

    Lovely tutorial. A bit sluggish on my FF10 on OSX 7 but I admit it must be computer performance. The other parallax websites are working OK though.

    • Alberto

      So we have our first greek AND our first nude guy! :D

  • dustin

    Is there IE fixes?

    • http://www.aaronlumsden.com Aaron Lumsden
      Author

      I’ve not tested this on anything below ie9. I think you should be able to use something like http://modernizr.com/ which will allow for HTML5 and CSS3 properties which are not available in older browsers such as ie8 and below. I’ve not tested this demo using it but I’m sure it will be possible with a little bit of tweeking :-)

      • Nicole

        Tried using modernizer but I’m still getting errors that break the design on IE8. Any ideas?

  • Ruven Spiller

    I was hardly waiting for a parallax tutorial. Thanks it is here now!
    Although it’s performance is a bit … slow.
    I’d like to read a few tips to tweak the speed.

  • http://www.deershadow.co.uk Martin Gordon

    Thanks for this tutorial, I’ve wanted to mess around with something like this since seeing the Nike ad.

    Question though, how come when the images hit the top of the window they disappear on chrome & safari, but they nicely scroll off the top of the screen in Firefox? Is there a good way to control this because it ruins it when viewed on Safari or Chrome.

    Thanks,
    Martin

    • http://www.cirkut.net Josh Allen

      Martin, what OS are you using? I’m using OS X Lion and Chrome AND Safari both run great. Not very sluggish on my end either.

      • Martin

        Hi Josh,

        I’m running Lion too.

        It does indeed work in both Chrome and Safari and it’s very smooth to boot, what I’m talking about is when an image hits the top of the window.

        Maybe this screenshot will better illustrate what I’m getting at:
        http://www.dearshadow.co.uk/milhouse/firefoxVSsafari.png

        As you can see in Firefox the image happily scrolls off the top of the page, when in Safari (and Chrome) it just disappears as soon as the top measurement of any image hits the edge of the window.

        Very odd!

        • Wojtek

          I have the same problem, I am using Chrome and OS Lion. Would appreciate help on that one.

        • zoran

          aah.. same problem here, any help with that? the stellar.js demos seem to work and larger images stay displayed when scrolling out of view… i thought it might have been caused by waypoints and disabled it, but still happens. any help would be awesome. great tutorial and very useful, i like it. cheers

        • http://ThemeSumo.com zoran

          hey Martin and Wojtek – I just got help from Mark (http://markdalgleish.com/projects/stellar.js/) and here’s the solution to the images disappearing. Add height and width to your images and they scroll nicely. Cheers

          • Andrew

            Hey Zoran, have you tested adding height & width to the images?

            I have tried it and the images still randomly disappear when they touch the top of the browser window. If you or anyone finds anything else please let me know.

            Thanks!

            Andrew

  • http://godsofart.com S3bY

    Wow..the effect is amazing!

  • http://waahahazam.com arukachi
    • http://www.cirkut.net Josh Allen

      That’s not really a parallax type website. It’s more or less a single-page template controlled by menu items. I do, however, like that one as well, but I think the tutorial here is a little more in-depth and more true to the ‘parallax’ style.

      Thanks for posting that link, I’m sure I’ll be able to use it on a future project!

  • http://www.cirkut.net Josh Allen

    I’ve been trying to think of how I wanted to do online RSVP’s and invitations for my wedding. I was going to do a simple one-page/one-frame site with minimal content, but the fiance wants something a little more elaborate. I’m going to be using this tutorial and creating a story of how we met, and how our lives are going to be. Thank you for this wonderful tutorial, I’ll be sure to post on here when I’m done with it!

    • http://www.webdesignlift.com Windo

      Would love to see how you draw the story out with parallax :)

  • http://www.seanmangosing.com Sean Mangosing

    Awesome tutorial. Just what I have been looking for to help me out.

  • Dave

    Is this working on the iPad?

  • Jermaine

    I love it!

  • http://www.shadedpixel.co.uk Jon M

    Awesome tutorial, been looking for something like this for a while. Is there any library or method in javascript/jQuery that would auto snap to the pages?

    For Example: The user scrolls down and stops at a page, after a short delay, the page will scroll to centre the content (with the easing).

    Thanks in advance.
    Jon.

  • http://faizdesign.wordpress.com Faiz Al-Qurni

    Absolutely useful tuts Aaron, thanks for sharing!

  • Pingback: How to use Stellar.js?

  • Hamid

    let’s hope maybe 1day we show a video tut of scrolling a website from tutsplus team, thx for the article.

  • idbranding

    If you resize the browser the parallax breaks down.. the windows resize perfectly but the overlays disappear.. how to fix? Great tutorial anyways !!

    • http://www.facebook.com/reese.holtze Reese Holtze

      mine does too. have you found any solutions??

  • Pingback: Weekly Web Developers Kit – vol. 14 (6-15-2012) « CSS Tips

  • http://www.technbuzz.com Samiullah

    Much smoother on firefox 16 nightly build

  • http://coder-design.com/ coder-design

    Good tutorial. I learn something from here. Thanks for sharing.

  • http://felixeloso.com Felix

    Hi so i’m trying to add a header at the top of the menu, and then have the menu stick after you start scrolling. I got that part to work, but when i add a header it kinda screws up the parallax scrolling for the menu.

    basically it won’t activate the current slide menu item until it’s a certain amount of pixels after. so if i click slide 3, it’ll go to it, but the nav item won’t be be activated until I scroll down a bit more. i paste the link below. any help would be greatly appreciated. I’m still pretty new to front end dev… well dev in general and i feel like this is something small i’m just missing it.

    http://felixeloso.com/parallax2/

  • http://designfrida.com foo

    very nice and it works on major browser….

  • http://www.wildemedia.co.uk Christine Wilde

    Will this work on a Tumblr theme? Baring in mind it would be using infinite scroll and each post would have to load as you scroll down. I really want to use this for my next Tumblr theme.

  • rohan

    Thankyou soo much for this tutorial!!

    Just one question;
    How do I get the slide to appear on the right hand side of the page, so instead of scrolling down ppl just have to scroll across???

  • http://www.800-webdesign.com batia

    If it doesn’t work with IE, it is useless and just serves the concept. But who needs it?

  • http://qoyyuum.blogspot.com Abdul Qoyyuum

    It doesn’t work with IE8. :( Anyone got a hack for it?

  • http://www.fiea.ucf.edu John Tran

    Anyone know how to make this scroll horizontally instead? I can’t for the life of me figure out where to do that.

  • Pingback: Scrolling Vines » E-Maile

  • Pingback: Best of Tuts+ in June 2012 | Clixto7

  • Pingback: Best of Tuts+ in June 2012 | DigitalMofo

  • Pingback: Create a Parallax Scrolling Website Using Stellar.js | Webdesigntuts+ » Web Design

  • Pingback: Best of Tuts+ in June 2012 | Shadowtek Hosting and Design Solutions

  • LIUK

    Parallax Scrolling is great!

    But.. How can I modified Parrallax for previous versions of IE9?

    Because in IE8 and older doesn’t work.

    Thanks!

  • Pingback: PSD+ Best of Tuts+ in June 2012 via buypappa.com | Buypappa blog

  • Pingback: NET+ Best of Tuts+ in June 2012 via buypappa.com | Buypappa blog

  • Pingback: VEC+ Best of Tuts+ in June 2012 via buypappa.com | Buypappa blog

  • http://www.afterburnerapp.com Greg

    Great tutorial!

    In Safari, if you go to a later slide, like slide 4, and then to slide 3, slide 3 does not get set as active.

    I found a fix for my site – I added this to js.js

    http://pastebin.com/raw.php?i=YPNfz8kP

    Probably a better way – and not tested.

    • Rob

      Thanks for fixing that as I ran into that problem, too. It wasn’t just Safari, though. It wasn’t working on any browser.

    • http://www.communitiesdna.com Jose Luis Murgas

      Greg, thanks for solving the problem, works perfectly for me.

    • Sam

      Works great to fix nav.. Please change this site to use this code as it fixes the issue! Nice one Greg!

  • Pingback: Best of Tuts+ in June 2012 | GMancer

  • Anthony

    Hi.

    At least two others asked the question I would like help with. How do you go horizontal instead of vertical?

    Thanks.

    • Jaypee

      I have the very same question but looks no one is reading :(

  • kw3ldud3

    Thanks for the tutorial…
    Plz help me out… i have to use image of resolution 1920*1440 as a cover background… but having a problem, the width is perfectly displayed but having issues with height… only half image is displayed in terms of height… :(

    Thanks…

    • Sam

      I could be wrong but the issue with height is so that bigger browsers see more image it will only show your browsers max height of the image.

  • Patrick

    I keep getting the error ‘css(…)’ is null or not an object in IE8… IE9 doesn’t have any error, but the parallax is not working at all… did I miss something??

  • Esaú

    Nice tut, just one question. How can I make that when someone scrolls just a little, the effect is applied atomatically and goes to the next section?

  • Yash

    Hey!
    Thanks a ton for this awesome post!
    Just wanted to know whether it can support Horizontal and Vertical Parallax simultaneously?
    Basically I am want something of this kind: http://www.bagigia.com/index.php

    • Sergiu

      Hey Yash,

      If you figured out how to do this please let me know too! I’m looking for the same thing.

      Thanks!

  • Josh

    I know a few folks have asked about where the code might be changed to force this to move horizontally. Can anyone share any insight into where to look to begin changing the code to allow it to move on a horizontal axis? many thanks in advance.

  • http://mayton.net Steven

    Where can I find empirical information about browser compatibility? I don’t have a Windows PC and, obviously, it would help to know before getting myself or clients all excited.

  • http://justinjwilson.com Justin
  • Pingback: 22 JavaScript/jQuery Tutorials for New Web Developers | Jason Chew

  • Pingback: JavaScript / jQuery Tutorials [22] | Plus Web Design

  • navinski

    The navigation seems a little odd. If you click on slide 4 and then click on slide 3, slide 4 remains “active”. Same thing for if you click on slide 3 and then click slide 2, slide 3 remains “active”. Slide 1works great. It seems that when you go back up the page after you have finished, it does work correctly. Any fixes?

    • Sam

      Same issue .. its in the js.js script .. if you go from 1 to 4 works correct for from 4,3,2 to 1 as there is a 0% code to make sure any number to 1 works .. going to work on a fix for this myself even if it is a long afair doing each slide manually.

      • mike

        Any word on a fix for this?

        • Mike

          Someone posted a fix a month ago:

          glnjnsn • a month ago

          If anyone encounters the problem, where the ‘active’ li, doesn’t follow the actually slide/pane, try this:

          Instead of:

          if (direction === ‘down’) {
          $(‘.navigation li[data-slide="' + dataslide + '"]‘).addClass(‘active’).prev().removeClass(‘active’); }
          else {
          $(‘.navigation li[data-slide="' + dataslide + '"]‘).addClass(‘active’).next().removeClass(‘active’); }

          Change it to:

          if (direction === ‘down’) {
          $(‘.navigation li[data-slide="' + dataslide + '"]‘).addClass(‘active’).prev().removeClass(‘active’); }
          else {
          $(‘.navigation li[data-slide="' + (dataslide-1) + '"]‘).addClass(‘active’).next().removeClass(‘active’); }

          • mark joseph lape

            thanks for this solution!

  • Adrian

    I have a problem. When i try to add another button inside the slides to go to another slide it wont work. how can i create navigation buttons. other than the one each slide already has?

    Thank you so much.

    • Sam

      Make sure you you select the slide as

      as it will not go to the slide if it set to another number.

      • Sam

        slide 5 my html code got edited out.

        • Adrian

          but is it possible to create a button inside a slide that can go to another slide?
          i tried with no success.

          • Adrian

            Fixed this! :D thanks. Now i have trouble with external links. seems the javascript blocks all traffic to external links. do you know how can i link an image to , i dont know, facebook?

  • Kyle

    Why does the data-stellar-ration affect the horizontal position? I was under the impression it only changed the speed at which the image scrolled. I’m still very confused about parallax scrolling. I wish you would have left out the waypoint stuff and just made the parallax as simple as possible.

    • http://www.facebook.com/XaviAlsoknownasSivo Xavi Alsoknownas Sivo

      Dude, for solve that problem you have to edit the stellar.js on the way it says: “horizontalScrolling: true,” and change it for “horizontalScrolling: false,”.

      • http://NirBenita.me/ Nir Benita

        OMG I’m putting a shrine with a picture of you! You have no idea how much this was helpful! I LOVE YOU

  • http://www.iamcolorblinddesign.com cero2k

    great tutorial, been wanting to learn this for a while.

  • http://www.netshellinfosystem.com/ ajit

    Nice create of parallax scrolling website using steller js..
    thanks for sharing..

  • Sam

    Hi nice script works well in all browsers I have tested windows 7 (Chrome,Opera,Safari,Firefox) .. The only issue that it has is that when you go back through menus items its menu is always 1 behind unless you hit slide1 then that is fine.. I think its down to the js.js script that sizes the selected menu as going forward works well.. Other than this no issues at all good starting point.

    • Jay

      I have found this too, any luck debuggin?

  • Pingback: Experiment « sceneteng.

  • http://philipp-seiffert.com PhSeiffert

    Great tutorial, definitely learned something new.

    And thanks for using my wallpaper on slide 4. Was really surprised to see it here. :-)

  • http://atulbhats.tk AtulBhatS

    Hello, i tried this on my personal site, and its working fine. but there is one problem.
    In the navigation menu, i added on more page, and it was working fine, then i removed the page, and removed the ‘data-slide’ parameter from tag for that slide, and added a <a> so that it takes the people to my blog. But sadly it doesnt work. The link appears to be fine, and when i hover my mouse over it, in the status bar, i get my link, but when i click no action takes place.
    Can anyone tell me how to fix this issue?

    Thank you

    • Adrian

      Im getting the same issue. seems like the javascript might be highjacking all the links that are inside the website. still havent found where exactly. im looking too.

    • Adrian

      Fixed it! add this to the javascript

      var links = $(‘.nav’).find(‘li[data-slide]‘);

      • http://atulbhats.tk AtulBhatS

        I actually tried

        onclick=”window.open(‘ [LINK] ‘,’_newtab’);

        and it leads to the page on click

  • http://falahati.net Soroush

    Just for info, adding an “overflow:hidden” to slide class will solve problems with chrome. (Check slide 3 and you can see an image out of screen that create a horizontal scroll too. That was reason for chrome’s problem.)

  • Pingback: Scrolling Vines | E-Maile

  • kochumvk

    Nice tutorial.

    I think $(this).data(‘slide’); is better than $(this).attr(‘data-slide’);, nothing to do with functionality, just that I would have gone that way.

  • http://atulbhats.tk AtulBhatS

    I used the thing on my site. (click on my name and you’ll go there) and i found out that Internet explorer doesnt support any effect. I know IE sucks and people hate it, but then the site must be accessible to all kinds of audience. So anyone here can tell me how to get it running on IE???

  • Michizzo

    Hi,

    First of all: Compliment, its a relly nice Tutorial.

    Furthermore, is there a way to snap the pages vertically like on the stellar.js homepage where it is realized horizontally?
    Would be very nice, if this could be added in the Tutorial :)

  • http://www.deadcowdesign.co.uk Deadcow

    Hi,

    Thanks for the tutorial, it’s useful and well written.

    It’s worth pointing out though (as per the Stellar website), that parallax elements must have a height and width defined (for example the screenshots in pane 3, and the balls on pane 2), if not in Chrome and Safari, they tend to vanish when they hit the top of the browser window.

    • ExCx

      I was searching for why that happens. Your post is a great help thanks :)

  • Proze

    Hi, nice tut……

    Wondering if anybody got it working in IE 8, IE 7 ?

    Thanks

  • Blake

    Anyone tried getting this to work on mobile yet?

    I’ve been looking around and iScroll and Scrollability but can’t wrap my mind around quite how to convert it.

    I figure adding an extra wrapper and scroller element around each of the pages might work?

    Any ideas?

  • Pingback: Free jQuery Parallax Web Banner « Web css jquery

  • Mohammad Torkashvand

    TanQ
    Very nice tutorial

  • Pingback: Tu web Parallax. Código y ejemplos. | Blog de Diseño Web

  • Pingback: Tu web Parallax. Código y ejemplos. « Posicionamiento de páginas y diseño web

  • Pingback: 2Foros – Tu web Parallax. Código y ejemplos.

  • http://www.thecode.org/ Iain

    Hi, thanks for this great tutorial. I’ve been trying it out and have added some text to the slides but on Chrome and Windows 7, there doesn’t seem to be any space between the words. Any idea how I tweak the CSS to make text easier to read please?

  • Pingback: Parallax Effect Tutorial » VC-TEL Team Blog

  • http://waahahazam.com/ arukachi

    I found this quite easy to understand & the best part is working on IE7 http://net.tutsplus.com/tutorials/html-css-techniques/simple-parallax-scrolling-technique/

  • Pingback: Excellent New jQuery Tutorials for Web Developers | webexpedition18

  • Pingback: How To Create A Parralax Website | Everything Web Based

  • Pingback: The Wonders of Parallax Design » Ecommerce Web Design Web Development Company Broadland Digital

  • Lamb

    I have a problem when the windows size of the browser changes, the objectis inside of the slides and the position of the background crashes (in the second, third an foutrh slide), your example, have the same bug! can you fix this? thanks!!

  • brad

    Error on IE 9… :(

    Message: Unable to get value of the property ‘split’: object is null or undefined

    Line: 2

    Char: 5706

    Code: 0

    URI: /html/paralax/js/jquery.stellar.min.js

  • discat

    Hey! Great tutorial thank you! Anyway to get it working on iPad?

  • Pingback: 18 Fresh jQuery Tutorials | Splashnology

  • Pingback: Marty's WebPress | This is Stellar!…No Seriously.

  • Goodtown

    Thanks very much for this tutorial!

  • Marlon Amancio

    Thanks a lot! This was a great starter for me. God bless!

  • Jana

    Very nice!
    How can I add a button to go back to the previous slide? Could anybody tell me what to add to the JS?
    Thanks!

  • Pingback: 10 Creative Websites with Parallax Scrolling Effects | ItamarGero.com

  • Pamela

    Really great tutorial. I’ve been having trouble with one aspect though. Whenever I surround an img tag in one of the slides, the image completely disappears. I definitely need to it link to another page. I was wondering if the solution is obvious. I combed through the css and I can’t figure out what’s going on.

  • josean

    Pretty nice, but it doesn´t works on IE.
    Neither the tipical anchor…. Any idea? Any solution?

  • MalaMoo

    Neither the demo or my development version work in ie8. I’m getting ‘css(…)’ is null or not an object. Any ideas? Works great in everything else :)

    • Malamoo

      Having given this some more thought I’m guessing it doesn’t work in ie8 because of the CSS3 and HTML support. I’m going to give modernizr a go. Could anyone point me in the right direction for the polyfills I’ll need?
      Thanks

      • ASAP Dorky

        So it works with IE9, but not any IE below that. I am looking for ways to solve this too. Have you figured out what to do with it using modernizr? thanks!

  • Newbie

    Hi, great tutorial!

    However, I have a question,

    I’m playing around with the ressources, and I want to add images on the 3d slide.

    There are the #slide3 img:first-child{ lines in the CSS styles but only for 6 images.

    How do I make the link between the images and that line (e.g. #slide3 img:first-child(7){ )

    there is no ID in the HTML so is this something in the java?

    I’m sorry, I’m a real newbie so.. thanks for your help :)

    • max

      #slide3 img:nth-child(7){} no ?

  • Meursault

    I am trying to add another slide, I can get a new slide to appear at the bottom end however the arrow ends at the bottom of the second slide and when I click the new slide on the nav bar it wont hover down to it. Where do I add this new slide in the JS? Sorry trying to reverse engineer it!

    Thanks is advanced

  • Pingback: Jason Addley University Blog

  • Pingback: JavaScript/jQuery Tutorials for New Web Developers

  • Pingback: One page storytellers « Logo Web Play

  • Pingback: 25 Best Parallax Websites, Jquery plugins and tutorials | AnimHuT

  • Pingback: 10 Ways To Add A Modern Touch To Your Website Today

  • Pingback: 23 Best Parallax Tutorials and Plugins

  • Sidimar

    Hello everyone,
    I’m using any images in the slides, and I need these images in 100%, like a “responsive”. But when I put in the css file, something like (max-height, max-width, width:100%) the scrolling have a leg.
    Anyone know what happening… tks

  • Pingback: 16 Very Useful Tutorials On Parallax Scrolling

  • anon

    Great tutorial. Quick note: the .button class should have “margin-left:-25px;” to be properly centered. Thanks for the help!

  • Niraj

    thnx..awesome ‘n’ so helpful

  • Pingback: Top 13 Jquery parallax Site Tutorial | Outsourcing Company Sri Lanka

  • Pingback: Top 13 Jquery parallax Site Tutorial | Multimedia Design Sri Lanka

  • Pingback: Top 13 Jquery parallax Site Tutorial « Web Design Sri Lanka

  • skategeo

    Awesome use of the tutorial. Looks great! I liked the start with the plane.

  • marvin

    Hi,

    first: nice Tutorial.

    I added a Slide and have now 5 Slides.

    If i click on a Link in the navigationbar, the site slides down to this point but if i now click und an upper link the

    Navigationbar doesnt transist.
    It only appears if im on the 3rd, 4th or 5th slide.
    Im not a pro so its hard for me to find a mistake.
    i think its in the Javascript but what do i need to add?

  • Pingback: Jazz up a Static Webpage with Subtle Parallax | Webdesigntuts+

  • http://www.facebook.com/cchsalazar Christian Salazar

    I noticed two issues, FIRST: mozilla sometimes shows horizontal scrollbar on second slide causing trouble with active slide detection on navigation bar. Fixed it with:

    html { overflow-x: hidden; overflow-y: auto; }

    SECOND: child images inside wrapper container position correctly with css, but lose their horizontal position when stellar initiliazes ( try commenting $(windows).stellar(); ). This seems to happen due to horizontal centering on wrapper with “auto”

    .wrapper { … margin:0 auto; … }

    if it is changet to { .. margin:0 0 … } it does not fail, but it will not be center-aligned :(

    Disabling horizontall scrolling on stellar constructor seems to fix it:

    $(window).stellar({
    horizontalScrolling: false,
    verticalOffset: 0,
    horizontalOffset: 0
    });

  • Dan

    Hi, Great tutorial.

    I was wondering how I can get the links to just change colour instead of size when they hit the relevant waypoint??

    Thanks

  • John Do

    Thank you so much, that’s greate!

  • DudsBabyDuds

    In Firefox & Safari the first slide on page load doesn’t become “active” within the navigation but does in Chrome & IE, however once you start scrolling it becomes active, why is this?

    • Dani De Wald

      Would also like an answer to this. Firefox and Internet Explorer (8) shows it as inactive.

  • Pingback: 18 Best jQuery Tutorials | HueDesigner

  • larry

    Hi thanks for that tutorial,

    It’s really cool…
    I have a question though,
    I add a class to the image in the center of the page and I what to change it depending on the data-slide that is active
    I was able to change the image class when I click on a button of the menu but when I use the scroll bar to navigate, the class of the image doesn’t change.

    does anyone knows how I can achieve this ?

    thanks

  • kfc

    hi trying to get this to work in ie8 – any suggestions?

  • http://www.facebook.com/leoveensma2 Leo Veensma

    Anybody found a solution for IE8 and lower?

  • Pingback: Researching Technology | Follow Me Through My Journey

  • Pingback: Researching Technology: Great Resources on Hand | Follow Me Through My Journey

  • glnjnsn

    If anyone encounters the problem, where the ‘active’ li, doesn’t follow the actually slide/pane, try this:

    Instead of:

    if (direction === ‘down’) {
    $(‘.navigation li[data-slide="' + dataslide + '"]‘).addClass(‘active’).prev().removeClass(‘active’); }
    else {
    $(‘.navigation li[data-slide="' + dataslide + '"]‘).addClass(‘active’).next().removeClass(‘active’); }

    Change it to:

    if (direction === ‘down’) {
    $(‘.navigation li[data-slide="' + dataslide + '"]‘).addClass(‘active’).prev().removeClass(‘active’); }
    else {
    $(‘.navigation li[data-slide="' + (dataslide-1) + '"]‘).addClass(‘active’).next().removeClass(‘active’); }

    • illebas

      Thank you!!!!!!!!!

  • Pingback: waypoint addClass and remove class of a "fixed" element works when going down but doesn't going up | BlogoSfera

  • Bruno Sousa

    Hi!.. Thanks for the amazing tutorial! It has helped me a lot!

    In any case, in my website I have on navbar fixed on top, and I need that the scroll animation apply a 90px of top offset.

    Can you help me to do this?

    Thanks in advance.

  • dudsbabyduds

    has anyone experienced problems with the navigation on the ipad? i’m finding when you tap on a slide, it will work perfectly the first time, then if you attempt to tap another slide it doesn’t do anything. However if you swipe to the next slide the navigation will work again…but same problem…only once???

  • Pingback: clickwowdesigns.com | What is Parallux Scrolling?

  • adrienne

    how to i change the data-stellar-background-ratio? i want it to move faster and not have the delay when you click from slide to slide?

  • adharacc

    Great tutorial :) But is there a way to do the effect with divs instead of images? Somebody knows how to do it?

  • Sajay

    Thanks for this nice tutorial, I always wanted to know how this is done..

  • http://www.facebook.com/tiago.lameiro.5 Tiago Lameiro

    how do we parallax horizontally and vertically at the same time?

  • Pingback: Getting Steller.js to work with iscroll.js - How-To Video

  • Pingback: Introduction to Parallax Scrolling In Web Design: 22 Examples and 5 Tutorials :: Sasha Endoh Design

  • Pingback: Getting Stellar.js to work with iscroll.js | BlogoSfera

  • Dani De Wald

    Question: On page load , the first LI (slide 1) in the navigation, doesn’t reflect that it’s active. How do I get it to show that at page load, it’ll be active?

    • Alex

      Hi I’m having the same problem. Did you manage to find a fix for this?

      • Alex

        I found the fix. Just give the navigation li an active class so it active on page load and the js will remove it when navigating down :)

  • Dani De Wald

    How do I make the navigation also be able to link to another page? If I set a “href” link on one of my nav buttons, nothing happens (I removed the data-slide=”#’ from the LI tag)

  • Dani De Wald

    I have a static page that uses the same navigation, that I would like to link back to the page that is the parallax page. How do I link from that navigation so that it goes to a specific slide on the parallax page?

  • http://twitter.com/thkxoo thkoo

    This is great! Thanks alot

  • Syafiq Izzat

    i try us this and added some more jquery and added background image to all of the slides and now have about 15++ slides it skinda laggy.. any solotions?

  • Russer

    it doesn’t work in ie7. WTF!

  • Elmer

    Hi there,

    Great tutorial! Is it possible to let the extra layers scroll downward?
    It seems i can only make them go upwards.

  • Yorick

    Good tutorial, but there is a very ugly bug between slide 3 and 4. The navigationbar isn’t recognizing it properly while scrolling manually. And manual scrolling by dragging the scrollbar causes a jump to the top??! Maybe you should fix that and update this article!

    • Yorick

      Ps. I’m using the latest version of Chrome (26.0.1410.64 m)