I have a div on my wordpress site that I would like toggle (slideup/slide down) using one of the menu items in the navbar. The menu item is of type custom. In the URL text field I have a hash tag.
Does anyone know a plugin or any other method to make this work. I searched google but all I could find was this plugin http://wordpress.org/plugins/jin-menu/ . Its description is perfect for the job but completely fails when I upload and try to use it.
According to Jin Menu documentation you can put a function into the Menu Option field.
With that said and the assumption you have Jquery already installed add this to your template.
<script>
jQuery(document).ready(function() {
jQuery('#idOfYourDiv').hide();
});
function toggleCollaspe() {
jQuery('#idOfYourDiv').slideToggle('slow');
}
</script>
add toggleCollaspe()
to your Menu Option
EDIT
after following the url i found the error to be on this line
$('#headerStyleType').html()
is should be
jQuery('#headerStyleType').html()
There are other such errors in the code too
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.