Make webparts header as collapsible accordion SharePoint 2010 Javascript
Sometimes when there are lots of web parts on the page we wish that all the web parts be accordion,
we can make them accordion using below script.
Now in this case i have restricted this script to run on specific page as i had implemented it in master page.
$(document).ready(function(){
if(window.location.href.indexOf("DEF") > -1 || window.location.href.indexOf("ABC") > -1) {
$(".ms-WPHeader").parent().parent().parent().parent().parent().find(".ms-wpContentDivSpace").toggle();
$(".ms-WPHeader").click(function(){
$(this).parent().parent().parent().parent().parent().find(".ms-wpContentDivSpace").toggle();
return false;
});
}
});
we can make them accordion using below script.
Now in this case i have restricted this script to run on specific page as i had implemented it in master page.
$(document).ready(function(){
if(window.location.href.indexOf("DEF") > -1 || window.location.href.indexOf("ABC") > -1) {
$(".ms-WPHeader").parent().parent().parent().parent().parent().find(".ms-wpContentDivSpace").toggle();
$(".ms-WPHeader").click(function(){
$(this).parent().parent().parent().parent().parent().find(".ms-wpContentDivSpace").toggle();
return false;
});
}
});
Comments
Post a Comment