Definitely, But you need to write some custom code using jQuery.
Something like,
jQuery('#mylist li').click(function(){
jQuery('#mylist li').removeClass('active'); //first remove all active class from list
jQuery(this).addClass('active'); //add active class to current item
});
In your css,
.active > ul { display:block }
thanks for your work and your answer.
I just do something similar but it doesnt want work.
I created a js file with the code you suggested and i called it in the header of wp
<script type=”text/javascript” src=”………/attivalink.js”></script>
. i modified style.css and nothing appen .
mylist
is the name of the menu that i created and putted in shortcode or somethingelse? thank u in advance
Thanks,
Here I’ve set up fiddle for you, http://jsfiddle.net/amitsukapure/h3z86/
Just add custom id or class for your list from shortcode menu.
thank u very much , i’ll try later
sorry , can u help me ? my code is http://jsfiddle.net/H34LA/1/
I’m stuck
ok i mistuke something but now it’s working thank u very much .
this is my solution i hope it can help someone π
http://jsfiddle.net/H34LA/4/
sorry again. with your plugin it works just for a while, after one second it desappear because (i think) shortmenu is inside the post that is refreshed when i click on the link. there is a solution? i put the code in the footer of WP
Yes will be, as li>a having urls. My plugin will just using WordPress’s function to build menu. And it retrieves menu items with respective urls.
You need to customized your menu as per your requirement,
– Remove urls from href attribute of parent li
– use on click of parent li event .menu > li
– do not use # in href, use javascript:void(0)