I am working with SP2013. My objective is to add an accordion View to a Summary Link Web Part. I added the Summary Link Web Part. Within the Summary Link Web Part, I created groups. Then I added a Content Editor Web Part. Within the Content Editor Web Part, I added the code found below to the HTML code. The CSS code works, however, the jquery script is not working properly. Can anyone tell what I am doing wrong with the code? Thanks for your help.
< <style type="text/css">
.groupheader{
background-color: #0072C6;
color: white;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
font-size: 140%;
padding: 0.5em;
padding-left: 0.75em;
margin-right: 0.5em;
margin-bottom: 1px;
}
.groupmarker:hover .groupheader{
cursor: pointer;
background-color: #0597FF;
}
.dfwp-list{
background-color: #0072C6;
margin-bottom: 0.5em;
margin-right: 0.75em;
}
.dfwp-list .item:hover{
background-color: #0597FF;
}
.dfwp-list .link-item a{
margin-left: 2em;
color: white;
}
</style>
<script>
$(document).ready(function(){
/* Slide up all link items and hide them */
$(".dfwp-list").slideUp("fast");
/* Binding a click event handler to the links: */
$('.groupheader').click(function(e){
/* Finding the drop down list that corresponds to the current section: */
var dropDown = $(this).next(".dfwp-list");
/* Closing all other drop down sections, except the current one */
$('.dfwp-list').not(dropDown).slideUp('slow');
dropDown.slideToggle('slow');
/* Preventing the default event (which would be to navigate the browser to the link's address) */
e.preventDefault();
})
})
</script> >
Sorce code from Stefan Bauers post Turn summary link web part into an accordion.