How do I change the body background image on different pages
Posted 14 years 10 months ago
Hi,
I'm using the Gantry framework for some custom templates and need to change the body background image for the various pages (menu items)
Can anyone tell me how I can do this, without resorting to adding PHP code to the template?
Re: How do I change the body background image on different pages
Posted 14 years 10 months ago
hi phil,
you can create several styles, each style can have a different background image.
then use the "per menu item" configuration to use the different styles on different pages of your site:
Re: How do I change the body background image on different pages
Posted 14 years 8 months ago
Hi,
i`ve seen the video right now. Is it possible to add a button to choose the individual background image in the template preferences? Where can i create several styles for the background image? I`ve seen only a color chooser.
Re: How do I change the body background image on different pages
Posted 14 years 8 months ago
I would use the page suffix feature of gantry when you are working with the basic gantry template.
1. In the template-parameters turn the page-suffix-feature to "on"
2. choose different "page-suffixes" for different menu-items like "bg-page-1", "bg-page-2" etc.
(you find this in the menu-items on the right in "parameters-system"
3. create a folder called "backgrounds" in the images-folder of your template and put your images into it.
4. add this to your css (I would use the style-css-files)
body.bg-page-1 {background: url(../images/backgrounds/img-sky.jpg) no-repeat 50% 0;}
body.bg-page-2 {background: url(../images/backgrounds/img-fire.jpg) no-repeat 50% 0;}
5. clear your cache ...
(you could add an option for that in the template settings,
but its far more complicated then using the page-suffix,
you can find more information about that in the gantry-docs)
Re: How do I change the body background image on different pages
Posted 14 years 8 months ago
Thanks a lot Henning. Where can i find point 2? Is it beside the defaults?
When i like to add the individual class in a page i have to add something like" body.bg-page-1" in the suffix box?