Project

General

Profile

« Previous | Next » 

Revision 2020828c

Added by Andreas Kohlbecker almost 4 years ago

fix #8888 adapting uv width to parent div width

View differences:

modules/cdm_dataportal/cdm_dataportal.module
167 167
        'preprocess' => FALSE
168 168
      )
169 169
    );
170
    
170

  
171 171

  
172 172
    // see https://github.com/proj4js/proj4js
173 173
    // http://openlayers.org/dev/examples/using-proj4js.html
modules/cdm_dataportal/js/universalviewer/jq-universalviewer.js
89 89
        var collectionIndex = urlDataProvider.get('c');
90 90

  
91 91
        console.log("setupUV() with " + plugin.options.manifestUri);
92

  
93
        var parentDivWidth = $(element).parent('div').width();
94
        console.log("  -> adjusting size from parent div: " + parentDivWidth);
95
        $(element).css('width', parentDivWidth);
92
        var uvElement = $(element);
93
        var parentDiv = $(element).parent('div');
94
        adaptSizeTo(uvElement, parentDiv);
95
        $(window).resize(function (event) {
96
            adaptSizeTo(uvElement, parentDiv);
97
        });
96 98

  
97 99
        var uvdata = {
98 100
            root: plugin.options.root,
......
122 124
    };
123 125

  
124 126

  
127
    var adaptSizeTo = function(uvElement, jqElement) {
128
        var parentWidth = jqElement.width();
129
        console.log("adjusting size from parent div :" + parentWidth);
130
        uvElement.css('width', parentWidth);
131
    }
132

  
133

  
125 134
})(jQuery, document, window);

Also available in: Unified diff