Prevent ol.css being added multiple times
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
This commit is contained in:
parent
9db0f07ecc
commit
c3266c2c52
@ -434,7 +434,13 @@ class GisVisualization
|
||||
$output = 'function drawOpenLayers() {'
|
||||
. 'if (typeof ol !== "undefined") {'
|
||||
. 'var olCss = "js/vendor/openlayers/theme/ol.css";'
|
||||
. '$(\'head\').append(\'<link rel="stylesheet" type="text/css" href=\'+olCss+\'>\');'
|
||||
. 'if (!document.querySelector(\'link[rel="stylesheet"][href="\' + olCss + \'"]\')) {'
|
||||
. 'var link = document.createElement(\'link\');'
|
||||
. 'link.rel = \'stylesheet\';'
|
||||
. 'link.type = \'text/css\';'
|
||||
. 'link.href = olCss;'
|
||||
. 'document.head.appendChild(link);'
|
||||
. '}'
|
||||
. 'var vectorLayer = new ol.source.Vector({});'
|
||||
. 'var map = new ol.Map({'
|
||||
. 'target: \'openlayersmap\','
|
||||
|
||||
Loading…
Reference in New Issue
Block a user