• Menno1987

    (@menno1987)


    I’ve just installed this plugin but it’s not working for me. I understand that it works with themes that use the background image in the “Body” element because this is set in the .js file. And i can see the style="background-position: -10px" being applied to the background image in the Chrome console.

    How can i get it to target body #background-container img on line 12?

    I know a little bit about code, but not so much on JavaScript.
    Thanks in advance ??

    https://www.ads-software.com/plugins/super-simple-jquery-parallax-background/

Viewing 1 replies (of 1 total)
  • Thread Starter Menno1987

    (@menno1987)

    I’ve changed to .js a bit … but it’s still not working.

    jQuery( document ).ready( function( $ ) {
        // Set the background-attachment for body to "fixed" so that
        // we can control it's scroll speed. You may have set this already
        // via the theme's 'customize' screen in WordPress. Just in case
        // it wasn't set correctly, we override it right here:
        $('body #background-container img').css('background-attachment', 'fixed');
    
        // Attach a function to watch the window.scroll event, and
        // move the background image slower than the content scroll.
        $(window).scroll(function () {
            $('body #background-container img').backgroundPosition = "0px " + (0 - (Math.max(document.documentElement.scrollTop, $('body #background-container img').scrollTop) / 4)) + "px";
        });
    });
Viewing 1 replies (of 1 total)
  • The topic ‘Not working?’ is closed to new replies.