add css class to menu item link

Feel free to talk about everything related to our Joomla Products
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Thu Jun 05, 2014 8:44 am
Hi there,
I have add a little js script to a site I am working on. It provides smooth scrolling to an anchor on the page with a vertical offset in px. Great when you have a fixed header/navbar like I do.
The problem I am facing is for the script to work there has to be a class added to the link. How can I add a class to a menu item? For some reason adding a class to the menu item does not work. I added it to "Menus/Menu item/link type/css style from link". But it does not show up. Anyone any ideas? Any help apreciated!
Thanks Marc

http://gideon.de-plantage.nl
(first menu item link does not work, on the second menu item the arrow half way works with the offset)
User avatar
Senior Boarder

GK User
Fri Jun 06, 2014 11:28 am
Hello,

Did you tried to add custom CSS class using our GK Extented Menu params plugin?
User avatar
Administrator

GK User
Fri Jun 06, 2014 12:44 pm
Hi dziudek,
Thanks for your reply. I dont think so. I just tried it with the normal menu item options, see image (attachment). Where would I find the GK Extented Menu params?

menu_item.jpg
User avatar
Senior Boarder

GK User
Fri Jun 06, 2014 1:47 pm
If you haven't the GK Params tab in your menu item editor you have to install a gkextmenu plugin from the rest files package.
User avatar
Administrator

GK User
Fri Jun 06, 2014 2:34 pm
Works great! Thank you very much dziudek!!
User avatar
Senior Boarder

GK User
Fri Jun 06, 2014 2:46 pm
I was too fast with my reply... :-( The smooth scoll on the page itself now works but the link when on an other page back to the first menu item does not do anything anymore... Makes sense?
User avatar
Senior Boarder

GK User
Fri Jun 06, 2014 6:07 pm
Could you better describe what is the problem now? Because I don't understand your description even when I look on your page ;)
User avatar
Administrator

GK User
Fri Jun 06, 2014 8:33 pm
aaah sorry... I will try to explain it better.
On the home page there is a section with an id="watbiedenwe". The menu item of "Home" is hidden through css. When you enter the site and click on the first menu item "WAT BIEDEN WE" there now is a smoothscroll to the id="watbiedenwe". With your help I was able to add the class "link" to that menu item ("WAT BIEDEN WE").
The only problem I now face is that when I navigate to an other menu item, like "IN 45 SEC" and from that page I try to get back to "WAT BIEDEN WE". Nothing happens... It probably now has nothing to do anymore with the Gavick template but with the js. But in the "gkscripts" there already is a smoothscroll script which could work?
User avatar
Senior Boarder

GK User
Sat Jun 07, 2014 2:53 pm
It is not working, because the links is "#watbiedenwe" - so it is an anchor to the element with ID set to "watbiedenwe" - on the other pages you have no elements with this ID so smootscroll cannot work.
User avatar
Administrator

GK User
Tue Jun 10, 2014 9:48 am
Hi dziudek,
I have the full url of the page as a link. So it shoud work. And it does work when I remove the "link" class.
I have to digg deeper! Thanks for your help!
User avatar
Senior Boarder


cron