Skip to content

Commit a7eb9c2

Browse files
committed
add noConflict functionality to all bootstrap plugins
1 parent 1c5b8e9 commit a7eb9c2

40 files changed

+519
-22
lines changed

docs/assets/js/bootstrap-affix.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
/* AFFIX PLUGIN DEFINITION
6969
* ======================= */
7070

71+
var old = $.fn.affix
72+
7173
$.fn.affix = function (option) {
7274
return this.each(function () {
7375
var $this = $(this)
@@ -85,6 +87,15 @@
8587
}
8688

8789

90+
/* AFFIX NO CONFLICT
91+
* ================= */
92+
93+
$.fn.affix.noConflict = function () {
94+
$.fn.affix = old
95+
return this
96+
}
97+
98+
8899
/* AFFIX DATA-API
89100
* ============== */
90101

docs/assets/js/bootstrap-alert.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
/* ALERT PLUGIN DEFINITION
6969
* ======================= */
7070

71+
var old = $.fn.alert
72+
7173
$.fn.alert = function (option) {
7274
return this.each(function () {
7375
var $this = $(this)
@@ -80,6 +82,15 @@
8082
$.fn.alert.Constructor = Alert
8183

8284

85+
/* ALERT NO CONFLICT
86+
* ================= */
87+
88+
$.fn.alert.noConflict = function () {
89+
$.fn.alert = old
90+
return this
91+
}
92+
93+
8394
/* ALERT DATA-API
8495
* ============== */
8596

docs/assets/js/bootstrap-button.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
/* BUTTON PLUGIN DEFINITION
6565
* ======================== */
6666

67+
var old = $.fn.button
68+
6769
$.fn.button = function (option) {
6870
return this.each(function () {
6971
var $this = $(this)
@@ -82,6 +84,15 @@
8284
$.fn.button.Constructor = Button
8385

8486

87+
/* BUTTON NO CONFLICT
88+
* ================== */
89+
90+
$.fn.button.noConflict = function () {
91+
$.fn.button = old
92+
return this
93+
}
94+
95+
8596
/* BUTTON DATA-API
8697
* =============== */
8798

docs/assets/js/bootstrap-carousel.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@
141141
/* CAROUSEL PLUGIN DEFINITION
142142
* ========================== */
143143

144+
var old = $.fn.carousel
145+
144146
$.fn.carousel = function (option) {
145147
return this.each(function () {
146148
var $this = $(this)
@@ -162,6 +164,14 @@
162164
$.fn.carousel.Constructor = Carousel
163165

164166

167+
/* CAROUSEL NO CONFLICT
168+
* ==================== */
169+
170+
$.fn.carousel.noConflict = function () {
171+
$.fn.carousel = old
172+
return this
173+
}
174+
165175
/* CAROUSEL DATA-API
166176
* ================= */
167177

docs/assets/js/bootstrap-collapse.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@
120120
}
121121

122122

123-
/* COLLAPSIBLE PLUGIN DEFINITION
124-
* ============================== */
123+
/* COLLAPSE PLUGIN DEFINITION
124+
* ========================== */
125+
126+
var old = $.fn.collapse
125127

126128
$.fn.collapse = function (option) {
127129
return this.each(function () {
@@ -140,9 +142,18 @@
140142
$.fn.collapse.Constructor = Collapse
141143

142144

143-
/* COLLAPSIBLE DATA-API
145+
/* COLLAPSE NO CONFLICT
144146
* ==================== */
145147

148+
$.fn.collapse.noConflict = function () {
149+
$.fn.collapse = old
150+
return this
151+
}
152+
153+
154+
/* COLLAPSE DATA-API
155+
* ================= */
156+
146157
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
147158
var $this = $(this), href
148159
, target = $this.attr('data-target')

docs/assets/js/bootstrap-dropdown.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
/* DROPDOWN PLUGIN DEFINITION
125125
* ========================== */
126126

127+
var old = $.fn.dropdown
128+
127129
$.fn.dropdown = function (option) {
128130
return this.each(function () {
129131
var $this = $(this)
@@ -136,6 +138,15 @@
136138
$.fn.dropdown.Constructor = Dropdown
137139

138140

141+
/* DROPDOWN NO CONFLICT
142+
* ==================== */
143+
144+
$.fn.dropdown.noConflict = function () {
145+
$.fn.dropdown = old
146+
return this
147+
}
148+
149+
139150
/* APPLY TO STANDARD DROPDOWN ELEMENTS
140151
* =================================== */
141152

docs/assets/js/bootstrap-modal.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@
193193
/* MODAL PLUGIN DEFINITION
194194
* ======================= */
195195

196+
var old = $.fn.modal
197+
196198
$.fn.modal = function (option) {
197199
return this.each(function () {
198200
var $this = $(this)
@@ -213,6 +215,15 @@
213215
$.fn.modal.Constructor = Modal
214216

215217

218+
/* MODAL NO CONFLICT
219+
* ================= */
220+
221+
$.fn.modal.noConflict = function () {
222+
$.fn.modal = old
223+
return this
224+
}
225+
226+
216227
/* MODAL DATA-API
217228
* ============== */
218229

docs/assets/js/bootstrap-popover.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
/* POPOVER PLUGIN DEFINITION
8282
* ======================= */
8383

84+
var old = $.fn.popover
85+
8486
$.fn.popover = function (option) {
8587
return this.each(function () {
8688
var $this = $(this)
@@ -100,4 +102,13 @@
100102
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
101103
})
102104

103-
}(window.jQuery);
105+
106+
/* POPOVER NO CONFLICT
107+
* =================== */
108+
109+
$.fn.popover.noConflict = function () {
110+
$.fn.popover = old
111+
return this
112+
}
113+
114+
}(window.jQuery);

docs/assets/js/bootstrap-scrollspy.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121
/* SCROLLSPY PLUGIN DEFINITION
122122
* =========================== */
123123

124+
var old = $.fn.scrollspy
125+
124126
$.fn.scrollspy = function (option) {
125127
return this.each(function () {
126128
var $this = $(this)
@@ -138,6 +140,15 @@
138140
}
139141

140142

143+
/* SCROLLSPY NO CONFLICT
144+
* ===================== */
145+
146+
$.fn.scrollspy.noConflict = function () {
147+
$.fn.scrollspy = old
148+
return this
149+
}
150+
151+
141152
/* SCROLLSPY DATA-API
142153
* ================== */
143154

docs/assets/js/bootstrap-tab.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
/* TAB PLUGIN DEFINITION
111111
* ===================== */
112112

113+
var old = $.fn.tab
114+
113115
$.fn.tab = function ( option ) {
114116
return this.each(function () {
115117
var $this = $(this)
@@ -122,6 +124,15 @@
122124
$.fn.tab.Constructor = Tab
123125

124126

127+
/* TAB NO CONFLICT
128+
* =============== */
129+
130+
$.fn.tab.noConflict = function () {
131+
$.fn.tab = old
132+
return this
133+
}
134+
135+
125136
/* TAB DATA-API
126137
* ============ */
127138

docs/assets/js/bootstrap-tooltip.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@
250250
/* TOOLTIP PLUGIN DEFINITION
251251
* ========================= */
252252

253+
var old = $.fn.tooltip
254+
253255
$.fn.tooltip = function ( option ) {
254256
return this.each(function () {
255257
var $this = $(this)
@@ -273,4 +275,13 @@
273275
, html: false
274276
}
275277

278+
279+
/* TOOLTIP NO CONFLICT
280+
* =================== */
281+
282+
$.fn.tooltip.noConflict = function () {
283+
$.fn.tooltip = old
284+
return this
285+
}
286+
276287
}(window.jQuery);

docs/assets/js/bootstrap-typeahead.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@
276276
/* TYPEAHEAD PLUGIN DEFINITION
277277
* =========================== */
278278

279+
var old = $.fn.typeahead
280+
279281
$.fn.typeahead = function (option) {
280282
return this.each(function () {
281283
var $this = $(this)
@@ -297,7 +299,16 @@
297299
$.fn.typeahead.Constructor = Typeahead
298300

299301

300-
/* TYPEAHEAD DATA-API
302+
/* TYPEAHEAD NO CONFLICT
303+
* =================== */
304+
305+
$.fn.typeahead.noConflict = function () {
306+
$.fn.typeahead = old
307+
return this
308+
}
309+
310+
311+
/* TYPEAHEAD DATA-API
301312
* ================== */
302313

303314
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {

0 commit comments

Comments
 (0)