Skip to content

Commit

Permalink
Fixed #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey committed Jun 11, 2015
1 parent 293b3ab commit d4ae17e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bootstrap-tabcollapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,19 @@


TabCollapse.prototype._initAccordion = function(){
this.$accordion = $('<div class="panel-group ' + this.options.accordionClass + '" id="' + this.$tabs.attr('id') + '-accordion' +'"></div>');
var randomString = function() {
var result = "",
possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 5; i++ ) {
result += possible.charAt(Math.floor(Math.random() * possible.length));
}
return result;
};

var srcId = this.$tabs.attr('id'),
accordionId = (srcId ? srcId : randomString()) + '-accordion';

this.$accordion = $('<div class="panel-group ' + this.options.accordionClass + '" id="' + accordionId +'"></div>');
this.$tabs.after(this.$accordion);
this.$tabs.addClass(this.options.tabsClass);
this.$tabs.siblings('.tab-content').addClass(this.options.tabsClass);
Expand Down

0 comments on commit d4ae17e

Please sign in to comment.