Skip to main content

Overview

The widget with a floor plan can be placed on a page in two ways.

Simple way

This method is suitable for simple static pages. The widget will appear on the page where the code was inserted.

Insert the following code into the page:

<script
charset="utf-8"
src="https://floors-widget.api.2gis.ru/loader.js"
id="dg-floors-widget-loader"
></script>
<script charset="utf-8">
DG.FloorsWidget.init({
width: '960px',
height: '600px',
initData: {
complexId: '70000001007418793',
options: {
locale: 'en_US'
}
},
});
</script>

Advanced way

Include the widget JS file on the page:

<script
charset="utf-8"
src="https://floors-widget.api.2gis.ru/loader.js"
id="dg-floors-widget-loader"
></script>

Add a div element to the page inside which you want to place the widget:

<div id="mywidget"></div>

Initialize the widget:

DG.FloorsWidget.init({
container: 'mywidget',
width: '960px',
height: '600px',
initData: {
complexId: '70000001007418793',
options: {
locale: 'en_US'
}
},
});

The container parameter contains the DOM element ID or the DOM element itself. This method is suitable for more complex cases where it is necessary to dynamically create a widget after opening the page (by pressing a button, etc.).