MCPcopy Index your code
hub / github.com/reactstrap/reactstrap / init

Function init

src/Offcanvas.js:303–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

301 }
302
303 init() {
304 try {
305 this._triggeringElement = document.activeElement;
306 } catch (err) {
307 this._triggeringElement = null;
308 }
309
310 if (!this._element) {
311 this._element = document.createElement('div');
312 this._element.setAttribute('tabindex', '-1');
313 this._element.style.position = 'relative';
314 this._element.style.zIndex = this.props.zIndex;
315 this._mountContainer = getTarget(this.props.container);
316 this._mountContainer.appendChild(this._element);
317 }
318
319 this._originalBodyPadding = getOriginalBodyPadding();
320 conditionallyUpdateScrollbar();
321
322 if (
323 Offcanvas.openCount === 0 &&
324 this.props.backdrop &&
325 !this.props.scrollable
326 ) {
327 document.body.style.overflow = 'hidden';
328 }
329
330 this.offcanvasIndex = Offcanvas.openCount;
331 Offcanvas.openCount += 1;
332 }
333
334 destroy() {
335 if (this._element) {

Callers

nothing calls this directly

Calls 3

getTargetFunction · 0.90
getOriginalBodyPaddingFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…