[SOLVED] Transparent header turns solid white upon scrolling
Hi Atahualpa community,
I need help on something that I haven't found the solution to. I have a header that includes a logo and a menu bar and is fixed in its position at the top. I would like the header to be transparent when I'm at the very top of the page so that the beautiful background image can show through, but turn solid white upon scrolling. I can't figure out what CSS code I should insert in order to accomplish this. Your help will be greatly appreciated. Thank you. Daniel |
Can you provide the URL of the site?
To change the property of the image 'on the fly' you are going to need a script to do it. You might want to look at the Jscript tutorials at https://www.w3schools.com/js/default.asp |
It's test.dlimconsulting.com.
It's a draft website in progress. |
Why don't you change the image by adding the whitespace to the top of it. Then make the logo/menu bar have a transparent background.
That way, when you scroll, the white - which is part of the image - will scroll up and the image will show thru the logo/menu. of course since threr is text scrolling wth the image. that will show behind the logo/menu when it scrolls far enough... |
That would actually do the opposite of what I want. I want the header to be transparent when the page is at the very top and then turn white when I'm scrolling. I hope this makes sense.
|
Ok, this isn't really an Atahualpa question, but a javascript question because you will need a javascript to do what you want. ut being intrigued, I thought I'd do some searching and see what I could find.
So I did a little googling and looked at w3schols.com and came up with this that would solve the case I first assumd it would be. This should be added to ATO->Add HTML/CSS Inserts->HTML Inserts: Body Bottom HTML Code:
<script> Feel free to ask for hints if you get stuck. |
Okay thanks. As I was trying out the javascript you shared, my first obstacle seems to be that the menu bar cannot have a transparent background. So I'll have to figure out how to fix that first.
|
hint: CSS inserts override what the theme options do....
|
Haha I know. I tried but adding this code in the HTML/CSS Inserts and it did not work.
Code:
|
that would work if that was the correct element. Try:
HTML Code:
div#menu1 ul.rMenu {background-color: transparent;} |
That did work to make the menu bar transparent, but the individual menu items still have a white background. You can look at the website to see what it currently looks like.
|
Using what I know about using CSS to modify lists, I added this but still no luck.
Code:
div#menu1 li { |
NVM. I figured it out. This is the correct code to make the menu items transparent as well.
Code:
div#menu1 ul.rMenu li { |
I tried the javascript and it works, but once the header turns white upon scrolling, it stays white even when I return to the top of the page. I'm missing a step in the script that tells it to go back to transparent when I'm at the very top. Your help would be appreciated. Thanks.
|
If possible, I would like the transition from transparent to white and back to transparent be on a gradient rather than abrupt, if that makes sense.
|
I used a different jscript and it seemed to do the trick. I didn't get the gradient transition I was looking for, but it's a minor detail at this point.
Code:
<script> |
I'm not seeing it on the site, you should disable your caching plugin when doing Development so you can see the changes as you make them.
|
Wow I did not know a cache plugin existed. I disabled and deleted them. Hopefully you can see it now.
I also figured out the gradient transition detail I wanted. Thanks for your help by the way. |
Glad I could help you learn something (grin)
|
All times are GMT -6. The time now is 11:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.