The main cause is that the map object is initialized before the dom elements are ready and parsed. When the map object is created, the dom element "map" occupies the whole page. That causes the offset of the popup. Do this.Change djConfig to below. Note you forgot to set async to true which is required for AMD mode.var djConfig = {
parseOnLoad: false,
async: true,
packages: [{
"name": "agsjs",
"location": location.pathname.replace(/\/[^/]+$/, "") + '/agsjs'
}]
};
Then, include "dojo/parser" to the dependency list, and set its alias to parser. require([
"dojo/parser",
"esri/map",
"esri/dijit/BasemapToggle",
"esri/dijit/HomeButton",
"esri/config",
"esri/dijit/Popup",
"dijit/dijit", // optimize: load dijit layer
"dijit/layout/BorderContainer", //HTML CONTAINER
"dijit/layout/ContentPane", //CONTAINER
"dijit/TitlePane", //CONTAINER
"esri/arcgis/utils", //Elements
"dijit/form/ToggleButton", //HTML
"dijit/form/Button", //HTML
"dijit/Dialog", //Required for Custom Splash Page
"esri/dijit/BasemapGallery", // Required for Basemap Gallery
"dijit/layout/AccordionContainer",
"dojo/fx", // needed if use jsapi 3.0
"agsjs/dijit/TOC",
"dojo/ready",
"dojo/domReady!"
], function(
parser, Map, BasemapToggle, HomeButton, esriConfig, Popup
) {
parser.parse(); // parse the page before the map is initialized.