Skip to content

Commit ae090d9

Browse files
committed
fix js error
1 parent 0f432b3 commit ae090d9

File tree

1 file changed

+63
-63
lines changed

1 file changed

+63
-63
lines changed

js/scripts.js

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -95,78 +95,78 @@ $(document).ready(function () {
9595

9696
// js
9797
$(document).ready(function () {
98-
function randomCarousel(id) {
99-
var num = $(id + ' .item').length;
100-
var slide = Math.floor((Math.random() * num));
101-
$(id + ' .item').each(function (index) {
102-
if (index == slide) {
103-
$(this).addClass('active');
104-
} else {
105-
$(this).removeClass('active');
106-
}
107-
});
108-
}
98+
function randomCarousel(id) {
99+
var num = $(id + ' .item').length;
100+
var slide = Math.floor((Math.random() * num));
101+
$(id + ' .item').each(function (index) {
102+
if (index == slide) {
103+
$(this).addClass('active');
104+
} else {
105+
$(this).removeClass('active');
106+
}
107+
});
108+
}
109109

110-
randomCarousel('#carousel-tweets');
111-
randomCarousel('#carousel-companies');
110+
randomCarousel('#carousel-tweets');
111+
randomCarousel('#carousel-companies');
112112

113-
var toc = $('#toc');
114-
if(toc.length) {
115-
toc.toc({
116-
'selectors': 'h2',
117-
'prefix': 'toc',
118-
'container': '#page',
119-
'anchorName': function (i, heading, prefix) { //custom function for anchor name
120-
return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, '');
121-
},
122-
});
123-
}
113+
var toc = $('#toc');
114+
if (toc.length) {
115+
toc.toc({
116+
'selectors': 'h2',
117+
'prefix': 'toc',
118+
'container': '#page',
119+
'anchorName': function (i, heading, prefix) { //custom function for anchor name
120+
return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, '');
121+
},
122+
});
123+
}
124124

125-
var page = $('#page table');
126-
var tocNext = $('#toc');
127-
var tocNextUl = $('#toc > ul');
128-
var tocNextUlLi = $('#toc ul.list li a');
125+
var page = $('#page table');
126+
var tocNext = $('#toc');
127+
var tocNextUl = $('#toc > ul');
128+
var tocNextUlLi = $('#toc ul.list li a');
129129

130-
if(page.length) {
131-
page.addClass('table table-striped table-bordered');
132-
}
130+
if (page.length) {
131+
page.addClass('table table-striped table-bordered');
132+
}
133133

134-
if(tocNext.length) {
135-
tocNext.toc({
136-
'selectors': 'h2,h3,h4',
137-
'prefix': 'toc',
138-
'container': '#page',
139-
//custom function for anchor name
140-
'anchorName': function(i, heading, prefix) {
141-
return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, '');
142-
},
143-
});
144-
}
134+
if (tocNext.length) {
135+
tocNext.toc({
136+
'selectors': 'h2,h3,h4',
137+
'prefix': 'toc',
138+
'container': '#page',
139+
//custom function for anchor name
140+
'anchorName': function (i, heading, prefix) {
141+
return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, '');
142+
},
143+
});
144+
}
145145

146-
// List.js
147-
if(tocNextUl.length) {
148-
tocNextUl.addClass('list');
149-
}
146+
// List.js
147+
if (tocNextUl.length) {
148+
tocNextUl.addClass('list');
149+
}
150150

151-
if(tocNextUlLi.length) {
152-
tocNextUlLi.addClass('searchitem');
153-
}
151+
if (tocNextUlLi.length) {
152+
tocNextUlLi.addClass('searchitem');
153+
}
154154

155-
var options = {
156-
valueNames: [ 'searchitem' ]
157-
};
158-
var userList = new List('searchable', options);
159-
// end List.js
160-
// docrdy
155+
var options = {
156+
valueNames: ['searchitem']
157+
};
158+
var userList = new List('searchable', options);
159+
// end List.js
160+
// docrdy
161+
162+
// Adding this layout functionality for mobile views with the homepage hero
163+
var navbarToggle = $('.navbar-toggle')
164+
if (navbarToggle.length) {
165+
navbarToggle.click(function () {
166+
$('.row.home').toggleClass('no-padding-top');
167+
});
168+
}
161169

162-
// Adding this layout functionality for mobile views with the homepage hero
163-
var navbarToggle = $('.navbar-toggle')
164-
if(navbarToggle.length) {
165-
navbarToggle.click(function(){
166-
$('.row.home').toggleClass('no-padding-top');
167-
});
168-
}
169-
=======
170170
function randomCarousel(id) {
171171
var num = $(id + ' .item').length;
172172
var slide = Math.floor((Math.random() * num));

0 commit comments

Comments
 (0)