- Posts: 118
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Creating Active 'Menu' item css highlight for K2 content module
Creating Active 'Menu' item css highlight for K2 content module
- Alan Sparkes
- Topic Author
- Offline
- Premium Member
Less
More
14 years 5 months ago #81891
by Alan Sparkes
Creating Active 'Menu' item css highlight for K2 content module was created by Alan Sparkes
Want active menu item css styles for your K2 module content items?Here is how;Open default.php (mod_k2_content/tmpl/Default/default.php)Add this just afetr line 13 :<?php //check url for K2 and get id to pass to loop to create active css class (JRequest::getVar('option') == 'com_k2') ? $k2id = JRequest::getVar('id') : $k2id ="";?>On line 22 change this: <li class="<?php echo ($key%2) ? "odd" : "even"; ?>"> to this: <li id="" class="<?php echo ($key%2) ? "odd" : "even"; ?> <?php echo ($k2id == $item->id.':'.$item->alias) ? "active" : "" ; ?>">Note we are just adding a space to the class and adding another class. You can then adjust your style sheets like so:.k2ItemsBlock ul li.active a {font-weight:bold;color:red}Now you have active item highlighting!
Please Log in or Create an account to join the conversation.
- vtiger
- Offline
- Premium Member
Less
More
- Posts: 83
14 years 5 months ago #81892
by vtiger
Replied by vtiger on topic Creating Active 'Menu' item css highlight for K2 content module
Usefull.
Thanks
LN
Thanks
LN
Please Log in or Create an account to join the conversation.
- Manos
- Offline
- Senior Member
Less
More
- Posts: 45
14 years 5 days ago #81893
by Manos
Replied by Manos on topic Creating Active 'Menu' item css highlight for K2 content module
Hi, is it possible to provide a file with the modifications?
Thanks
Thanks
Please Log in or Create an account to join the conversation.
- Mark Law
- Offline
- New Member
13 years 7 months ago #81894
by Mark Law
Replied by Mark Law on topic Creating Active 'Menu' item css highlight for K2 content module
Thanks Alan, this should be included in the core for sure!
An essential addition to K2, many thanks :)
An essential addition to K2, many thanks :)
Please Log in or Create an account to join the conversation.
- Willy Wong
- Offline
- New Member
Less
More
- Posts: 4
12 years 1 month ago #81895
by Willy Wong
Replied by Willy Wong on topic Re: Creating Active 'Menu' item css highlight for K2 content module
This doesn't work for me. Anyone could guide me on this? Thank you.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Creating Active 'Menu' item css highlight for K2 content module