- This topic has 12 replies, 2 voices, and was last updated 4 years ago by
Tom.
-
AuthorPosts
-
May 31, 2019 at 8:47 am #916437
Andy
Hi,
I used the instructions in the following thread to create a custom animated hamburger icon:https://generatepress.com/forums/topic/animated-hamburger-icon/
I have it working correctly, except the open icon is not in the same position as the close icon, as they are in the demos here:https://jonsuh.com/hamburgers/
I think it’s something to do with the flexbox CSS used in the header but can’t figure out exactly the cause.
Any help much appreciated.
May 31, 2019 at 9:02 am #916447Andy
ok, I almost have them positioned correctly now, the old menu was pushing the closed icon out of position. However, there is still some slight visible vertical movement when the icon transitions from open to close and vice-versa. Tried playing around with positioning values but just can’t get it as accurate as on the demo site.
May 31, 2019 at 3:33 pm #916679Tom
Lead DeveloperLead DeveloperStrange, it looks like the actual hamburger and close icon are perfectly aligned. Is it only when the lines are transitioning to the X that the weirdness happens?
May 31, 2019 at 3:53 pm #916704Andy
Yeh in the transition it just appears to move more than in the demo version. Maybe it’s just an optical illusion, does it look right to you?.
June 1, 2019 at 6:47 am #917048Tom
Lead DeveloperLead DeveloperI can kind of see what you mean, although I’m not exactly sure how to fix it.
Does the same kind of thing happen if you use a different style?
June 1, 2019 at 8:54 am #917198Andy
I’ve changed it to slider now and it doesn’t seem to have the same issue. I think it must be because I changed the spacing between the bars on the previous one. Would really prefer the bars closer together though.
June 1, 2019 at 4:23 pm #917343Tom
Lead DeveloperLead DeveloperAh, so you brought the bars closer together? What CSS did you use?
June 1, 2019 at 4:51 pm #917357Andy
This is all the CSS I had applied to it:
.menu-toggle .hamburger { padding:0; } .hamburger .hamburger-box { width:25px; } .hamburger .hamburger-inner, .hamburger .hamburger-inner::before, .hamburger .hamburger-inner::after { width:23px; height:2px; } .hamburger .hamburger-inner::before { top:-6px; } .hamburger.hamburger--collapse .hamburger-inner::after { top:-12px; } .hamburger--collapse.is-active .hamburger-inner { bottom:-3px; }
June 2, 2019 at 7:14 am #917780Tom
Lead DeveloperLead DeveloperHmm, I assume it’s the negative values. Is the current animation the one you want to stick with?
June 2, 2019 at 12:18 pm #917940Andy
Yes I think we’ll stick with this slider animation.
June 2, 2019 at 2:24 pm #918024Tom
Lead DeveloperLead DeveloperWhat about this?:
.hamburger--slider:not(.is-active) .hamburger-inner::before { top: 7px; } .hamburger--slider:not(.is-active) .hamburger-inner::after { top: 14px; } .hamburger--slider:not(.is-active) .hamburger-inner { top: 6px; }
June 2, 2019 at 3:44 pm #918047Andy
Thank you, looks good I think, what do you think?
June 3, 2019 at 9:06 am #918703Tom
Lead DeveloperLead DeveloperMuch better for sure 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.