Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full page background separate for every menu item #3171

Open
Kordolio opened this issue Aug 16, 2023 · 13 comments
Open

Full page background separate for every menu item #3171

Kordolio opened this issue Aug 16, 2023 · 13 comments

Comments

@Kordolio
Copy link

Hello, what if I wanted to have a separate full background image for every menu item?
This solution works for the body of all menus:
body {
background-image: url('../../../../image/_DSC0002edit1.jpg');
background-repeat: no-repeat;
background-size: cover;
background-position: 50% 50%;
background-attachment: fixed;
}
and I added it to the
/templates/#template/scss/nature/styles/_core.scss
but then I have one background image for the entire page.
Thanks for help!

@N8Solutions
Copy link

@Kordolio
Copy link
Author

Well this address leads to a strange page where I am asked to install several programs. I chose one and opened it in the browser, see a chat,but no answer to my question...

@N8Solutions
Copy link

@Kordolio Try using a Laptop/Desktop, not on a mobile. It will open the thread where I discussed this with someone previously.

@Kordolio
Copy link
Author

I am doing it on a laptop. I am choosing "Element", then continue with browser and get a strange error Laden der Verlaufsposition fehlgeschlagen, Das Laden einer bestimmten Stelle im Verlauf des Raumes zu laden ist gescheitert, da sie nicht gefunden wurde.
Afterwards I see some conversations and the recent one is from yesterday, does not concern me.
Could you please answer here or paste your answer here?
Thank you in advance!

@N8Solutions
Copy link

@Kordolio This link should work. It is to the original message in the room, not a message contained in a thread. It seems to have an issue with the thread. Apologies, but I'm just a volunteer, and don't have the time right now to go through the thread and copy everything out. Just be sure to read all conversation in the thread.

https://matrix.to/#/!DuqVGiFSbDhqvCJkox:gitter.im/$9wIua_l1eju-CVLrkVV7JW055ZGrSo0JryNUlvaqJFQ?via=gitter.im&via=matrix.org&via=monero.social

@Kordolio
Copy link
Author

@N8Solutions thank you, it is working now. However this does not solve my problem. I am no programmer and I am just a beginner to css, but I assume I need to write something in the css file to let the system know, where I would like to have which background.
And this is what I do not know. The "body" refers to the body of the whole page. What if I want to have "body" for page (or better said menu) 1, menu 2 and menu 3? How do you call it then?
Is it ok to give css class to the joomla menu item, for example "menu1", "menu2"
How to call it in the css??? "body.menu1"? "body menu1"?
Thank you in advance!

@Kordolio
Copy link
Author

Kordolio commented Aug 18, 2023

Or maybe like that?
.menu1 #body {
background-image:url("../images/Bottom_texture.jpg");
background-size: cover;
background-repeat: no-repeat;
}

@Kordolio
Copy link
Author

OK, you will not believe this, but I got this.
body.menu1
Thank you!

@N8Solutions
Copy link

N8Solutions commented Aug 18, 2023 via email

@Kordolio
Copy link
Author

Thank you, but it is easier for you to say, than for me to do :-)
What is the syntax of the menu item ID body, then?
body.menuitem.123
???

@N8Solutions
Copy link

N8Solutions commented Aug 18, 2023

OK, you are going to need to learn how to use the "inspection tools" of your browser to be able to "inspect" your website so you can see how things are working and be able to figure out if something is not working as it should.

With that said, with Joomla, you can see the "ID" of the "Menu Item" from the administrative side. It will be the far right column. So if your "Home" menu item has an ID of 121, then the CSS ID to target will be itemid-121. If the Menu Item ID is 221, then the CSS ID to target will be itemid-221, etc...

Besides looking in the admin area, you can "inspect" the website and find it from the front end. I've included pictures so you can understand where to look. I can't tell you what your Menu Item ID's are, you are going to have to figure that out for yourself because they will differ on each website.

kordolio-01

In the above image you can't see the Item ID, but if you double click in that area, you will be able to see it as I've highlighted here.
kordolio-02

The ID id="g-page-surround" is what you want to target to place the background image as I've specified in the other thread.

I can provide you with an example styling code for a menu item and you can see if that works for you once you enter your Menu Item ID.

You will need to enter the css in the custom.scss file. You can read the documentation by following the link on how to create a custom style sheet.
https://docs.gantry.org/gantry5/tutorials/adding-a-custom-style-sheet

/*  BACKGROUND IMAGE  */
/*  itemid-xxx = menu item id  */
/*  change the xxx to match your menu item id number  */
.itemid-xxx {
	#g-page-surround {
		background-image:
			url(gantry-media://backgrounds/background-image.jpg);
			background-repeat: repeat;
			background-attachment: fixed;
	}
}

FYI, The URL line is for the Joomla images folder. So where I have backgrounds/background-image.jpg the backgrounds folder is a subfolder of the Joomla images folder which you need to create if you plan on using it.

If you don't change the opacity of the sections on the website to transparent, the background image will not show up. So make sure you make those changes. You can do that under the "Styles" tab in the Gantry admin.
https://docs.gantry.org/gantry5/configure/styles

@Kordolio
Copy link
Author

Thank you very much, it was a great help.
However I have a small issue: every menu is a phoca gallery. the page is https://test.aquila-it.pl
When I go to Nature menu, the correct background image is displayed. But when I then click on any gallery category, the image changes to the "Landscape Menu" image.
Thanks in advance for help on that one.

@N8Solutions
Copy link

Thank you very much, it was a great help. However I have a small issue: every menu is a phoca gallery. the page is https://test.aquila-it.pl When I go to Nature menu, the correct background image is displayed. But when I then click on any gallery category, the image changes to the "Landscape Menu" image. Thanks in advance for help on that one.

@Kordolio If you look at the URL after clicking on any of the gallery catalogs listed on the "Nature" menu page, it switches to "Landscape".
The Nature URL is this:
https://test.aquila-it.pl/index.php/en/nature

But by clicking on "Fungi" for example, it switches to Landscape.
https://test.aquila-it.pl/index.php/en/landscape/183-fungi
and this is why the "Landscape" menu background image is shown instead of the "Nature" menu background image.

So this has something to do with the way you have setup the Phoca Gallery and is not a Gantry 5 issue.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants