1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved Changing background image in Header & Navigation module dynamically

Discussion in 'Basic Support Forum' started by Jason Davey, Aug 6, 2018.

  1. Jason Davey

    Jason Davey New Member
    Divi Ultimate Child Theme Divi Powerful Child Theme Divi Ultimate Archive Plugin Divi Ultimate Blog Plugin Divi Ultimate Header Plugin Divi Ultimate Footer Plugin

    Hi there,

    I am using Header and Navigation layout style 5.

    On full width browser sizes, I want to be able to have the background image change whenever a new nav item is selected. (i.e. a different background image for each nav section).

    I'm thinking there might be a simple css code snippet and have all the relevant images loaded and referenced from the media library.

    Any help is greatly appreciated.

    Cheers,
    JD
     
    1. PRO MEMBER PERKS Divi Ultimate Footer Plugin - Custom global Divi footer (20 premade styles) + Revealing footer effect:Learn More
  2. Divi.Help Pro Support

    Divi.Help Pro Support Administrator
    Staff Member

    Maybe you can try something like this:

    Step 1
    Add a unique CSS class to the background image section.

    Step 2
    Navigate to the page where you want to change the background image & find the "page-id-xxxx" at the body tag.

    Step 3
    Use something like the CSS below to change the background image based on the page you're on:
    Code:
    Log In or Sign Up to view this code.
     
  3. Jason Davey

    Jason Davey New Member
    Divi Ultimate Child Theme Divi Powerful Child Theme Divi Ultimate Archive Plugin Divi Ultimate Blog Plugin Divi Ultimate Header Plugin Divi Ultimate Footer Plugin

    Hi there - thanks for your speedy reply.
    I've pasted the code as below into the custom css section and I get the following errors (see attached).

    Screen Shot 2018-08-07 at 01.38.33.png
    The following gives a result of 0 errors:

    .page-id-xxxx .unique-css-class .et_parallax_bg {
    background-image: url("xxxxxxxxxxxxxxxxxx");
    }

    Any help greatly appreciated.

    cheers,
    Jason


     
    1. PRO MEMBER PERKS Divi.Help One-Page Layouts - Beautifully crafted one-page Divi layouts just for you:View All Layouts
  4. Divi.Help Pro Support

    Divi.Help Pro Support Administrator
    Staff Member

    The CSS is meant to be put at Divi -> Theme Options -> Custom CSS.

    For the CSS:
    Code:
    Log In or Sign Up to view this code.
    page-id-xxxx you need to replace with the page-id of the page that you want to change the background image.
    You need to press right click & click Inspect to access the console shown in the screenshot below.

    upload_2018-8-7_0-23-7.png

    As for the unique-css-class, you need to add it to the background image section, as per the screenshot below.
    **You can change it into any words that you want.

    upload_2018-8-7_0-26-28.png

    As for the background-image: url("xxxxxxxxxxxxxxxxxx");, replace the xxxx with the image URL that you want to use.
     
  5. Jason Davey

    Jason Davey New Member
    Divi Ultimate Child Theme Divi Powerful Child Theme Divi Ultimate Archive Plugin Divi Ultimate Blog Plugin Divi Ultimate Header Plugin Divi Ultimate Footer Plugin

    Fantastic! All is working now.
    Thank you so much for your assistance!!!

    have a great day.
    :)
     
    1. PRO MEMBER PERKS Divi Block Pro - Easy-to-use drag & drop interface to mix & match 456+ premade Divi blocks & export as json file:Learn More