- This topic has 7 replies, 3 voices, and was last updated 3 years, 3 months ago by Ying.
-
AuthorPosts
-
January 13, 2021 at 2:52 pm #1617741Jackie
Hi,
I am currently redeveloping our website on a separate domain and am trying to add an SVG separator after the navigation.
I have the options enabled to use the navigation as the header and am using the
generate_after_header
hook to add the inline SVG.The issue I am having is when it comes to the sticky navigation. I am using the sticky nav that is hidden on scroll up and animates into view on scroll down.
I have tried adding CSS animations to the fixed SVG to match the sliding of the sticky navigation but haven’t achieved the best results so far.
I assume the sticky nav animation works by using JS, is there any way I can use the exact same animation on the SVG so it animates perfectly with the sticky nav or would there be an easier way of achieving the same result?
I have included the link to the site in the Private information section so you can see where I have got to so far with this.
Many thanks for your help in advance.
January 13, 2021 at 5:56 pm #1617843ElvinStaffCustomer SupportHi,
Instead of hooking it in as an element, can we try a pseudo element CSS approach?
Try saving your SVG separator as a file and upload it to your media library.
To do that, you must first add SVG support to your WordPress site so it allows for SVG file upload.
You can install plugins for this. Try installing “Safe SVG” plugin.
Once you’ve uploaded the SVG file, you can add this CSS:
nav#site-navigation:after, nav#sticky-navigation:after { content: ""; width: 100%; height: 25px; display: block; position: absolute; background-image: url(URL of your .svg file here); }
Here’s a demo site of this in action: Demo site
January 14, 2021 at 12:50 pm #1619045JackieHi Elvin,
Thanks for your recommendation.
I have commented out the inline SVG, uploaded the SVG to the media library and tried the pseudo element approach as suggested.
It’s close to working but when you scroll down to the point where the sticky nav is triggered (as in all of the css classes such as
is_stuck
are added to the#sticky-navigation
element) there is some strange behaviour happening with the separator and I’m not sure what’s causing this.You can see the updated example on the link provided in the private information box again.
Any further help you could provide would be really appreciated.
Many thanks.
January 14, 2021 at 2:31 pm #1619137YingStaffCustomer SupportHi Jackie,
Try to add this CSS:
nav#sticky-navigation:not(.sticky-nav-scrolling-up) { top: -120px !important; }
Let me know how it works ๐
January 15, 2021 at 5:53 am #1619862JackieHi Ying,
I’ve added that code as well and it removes the strange behaviour so thanks for your help with this.
The only slight issue now is that when the sticky navigation is fixed and you scroll further down the page the navigation snaps away instead of fading up. Is there a way to resolve this issue?
Updated example in private information again.
Many thanks for your help so far with this.
January 15, 2021 at 10:09 am #1620397YingStaffCustomer SupportHi Jackie,
I can see the issue here, I’m afraid it will require some custom JavaScript solution which is beyond the scope of this support forum.
Thanks for your understanding.
January 16, 2021 at 1:17 am #1620958JackieHi Ying,
No problem, I thought this might be the case.
Thanks for your help anyway.
January 16, 2021 at 9:12 am #1621495YingStaffCustomer SupportYou are welcome!
Btw beautiful site ๐ -
AuthorPosts
- You must be logged in to reply to this topic.