Simple Background Parallax

Create a simple background parallax with the following instructions.


        var jQuerybgobj = jQuery(this); // assigning the object

        jQuery(window).scroll(function() {

            var yPos = -(jQuerywindow.scrollTop() /'speed')); 

            // Put together our final background position
            var coords = yPos + 'px';

            // Move the background
            jQuerybgobj.css({ backgroundPosition: coords });


The above code finds the background image being used within your content and adds an alternate scrolling speed to it.

<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );  ?>

<div id="main" data-parallax="scroll" data-image-src="<?php echo $image[0]; ?>" >

Sourced here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.