Tagged: x
-
AuthorPosts
-
October 27, 2016 at 7:07 pm #1233951
christiaan001ParticipantHi Guys,
I wanting to set a ‘current-menu-item’ class to the woocommerce cart in the top navbar so as to set styling to the cart when the cart page is active.
I have noticed that when an x page is active the class ‘current-menu-item’ is inserted into the html to set the navbar styling.
How might I best achieve this?
October 27, 2016 at 11:54 pm #1234244
Prasant RaiModeratorHello Christiaan,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
Thanks.
October 28, 2016 at 5:16 am #1234610
christiaan001ParticipantHi,
I’m developing locally, is there anyway you could still assist?
October 28, 2016 at 8:36 am #1234749
Paul RModeratorHi,
You can add this under Custom > Edit Global CSS in the Customizer.
.woocommerce-cart .x-navbar .x-nav > li.x-menu-item-woocommerce > a .x-cart > span.outer { color: #ffdedd; background-color: #ff2a13; } .woocommerce-cart .x-navbar .x-nav > li.x-menu-item-woocommerce > a .x-cart { color: blue; background-color: #ffdedd; }You may change the colors.
Hope that helps
October 28, 2016 at 4:48 pm #1235302
christiaan001ParticipantThanks Paul,
I have already implemented your suggestion to change the styling of ‘.woocommerce-cart .x-navbar .x-nav > li.x-menu-item-woocommerce >’ a .x-cart element, including hover states.
What I trying to do is change the styling of the above element when the ‘cart’ page is the ‘current menu item. I.E. when the cart page is the current page the user is visiting.
I have noticed that when any other page is ‘the current page’ then a .current-menu-item class is created for that menu li item.
How can I style the cart when the cart page is the current page being viewed?
Have attached images to help clarify.
Thanks
Christiaan
October 29, 2016 at 1:27 am #1235636
ChristopherModeratorHi there,
Please add following code as well :
li.menu-item.current-menu-parent.x-menu-item.x-menu-item-woocommerce a:hover { box-shadow: 0 2px 0 0 #ff2a13 inset; }Hope it helps.
October 29, 2016 at 5:35 pm #1236204
christiaan001ParticipantHi Christopher,
Thanks for your suggestion.
Unfortunately your solution is for the hover state. Which I can style already.
What I’m trying to achieve is to style the ‘cart’ top menu item when the ‘cart page’ is the active current page. IE the user is viewing their cart.
I have noticed that when other menu items eg. Home, About, Services etc are the current active paged being viewed, a ‘current-menu-item’ class is created in the html.
How can I add such a class to the html of the cart list item markup so as to be able to style the cart when it is the current menu item.
thanks again,
Christiaan
October 30, 2016 at 1:50 am #1236408
ChristopherModeratorHi there,
Please add this code :
.woocommerce-cart li.menu-item.current-menu-parent.x-menu-item.x-menu-item-woocommerce a { box-shadow: 0 2px 0 0 #ff2a13 inset; }Hope it helps.
October 31, 2016 at 6:23 pm #1238461
christiaan001ParticipantThat’s the one!
Thanks for your guys, problem solved.
Christiaan
October 31, 2016 at 10:51 pm #1238687
Prasant RaiModeratorYou are most welcome. 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1233951 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
