Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Accordion for SharePoint
$('head').append($('<link rel="stylesheet">').attr('href', 'http://twitter.github.com/bootstrap/assets/css/bootstrap.css'));
$.getScript('http://twitter.github.com/bootstrap/assets/js/bootstrap-transition.js', function() {
$.getScript('http://twitter.github.com/bootstrap/assets/js/bootstrap-collapse.js', function() {
var $collapse = $('<div class="accordion">');
var $tplHead = $('<div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse">');
var $tplBody = $('<div class="accordion-body collapse"><div class="accordion-inner">');
$('.s4-ba .s4-wpTopTable:has([webpartid])').each(function(i) {
var $wp = $(this);
var $content = $wp.find('[webpartid]');
var $head = $tplHead.clone();
var $body = $tplBody.clone();
if (i === 0) $body.addClass('in');
var $group = $('<div class="accordion-group">').append($head).append($body);
$head.find('a').text($wp.find('tr:first').text().trim()).attr('href', '#collapse' + i);
$body.attr('id', 'collapse' + i).find('div:last').append($content.clone());
$collapse.append($group);
}).first().before($collapse);
$collapse.collapse();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.