• Resolved Rosijanni

    (@rosijanni)


    Hello everyone!

    I’m developing a very simple theme and I’ve a design problem. I’ve many Pages and every single page should have an own full scaled background image (So it should be the background of the whole page).
    Of course, it’s easy to write it in the style.css body as cover-sized. But that’s not dynamically, I think. It’s not important, that it’s easy to change.

    My first thought was:
    Check the page ID in big if/else loop and set the image in body style by jQuery.

    So, what’s your opinion on how to implement such dynamic background images?

    Thank’s for reading,
    Jan

Viewing 6 replies - 1 through 6 (of 6 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Dynamic as in selectable through the admin section?

    Thread Starter Rosijanni

    (@rosijanni)

    That’s not required, that would be interesting but more work cause of upload stuff and so on.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    How do you want the background dynamic?

    Thread Starter Rosijanni

    (@rosijanni)

    Dynamic in my way:
    Open Page with ID 46 -> Page displays Background-image 1;
    Open Page with ID 22 -> Page displays Background-image 3;
    and so on…

    But I really don’t know whether my way is right. At the moment I’m trying to achieve it by check ID with PHP -> set BackgroundImage by jQuery

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    That way sounds like what is achieved with CSS.

    How will PHP know which background image to set, other than telling it each URL/ filename?

    Thread Starter Rosijanni

    (@rosijanni)

    You’re right! 😀
    Problem solved and works! 🙂

    Thank you, Andrew!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Dynamic Background Images (by page)’ is closed to new replies.