// Used in css to trigger a resize
$('body').append('<span id="_responsive" style="display:none"></span>');
+ //that.resize();
+ //$( window ).resize(that.resize);
+ $(window).on('load resize',that.resize);
+
+ }
+
+ this.resize = function() {
// Max width for blocks
var block = $("table, div");
if (block) {
var width = $(window).width();
- if (block.width() > width) {
- block.css({
- 'display': 'block',
- 'overflow': 'scroll',
- }).width(width - 10);
- }
+ var set_width = width - 20;
+ block.each(function(){
+
+ var first_width = $(this).attr('nb.resize');
+ var cur_width = $(this).width();
+ if (cur_width > width) {
+ if (!first_width) {
+ $(this).attr('nb.resize',cur_width);
+ }
+ if (this.tagName == 'TABLE') $(this).css({
+ 'display': 'block',
+ 'overflow': 'scroll',
+ });
+ $(this).width(set_width);
+ //console.log(this.tagName+' : '+$(this).width()+' / '+width);
+
+ } else {
+
+ if (first_width) {
+
+ if (this.tagName == 'TABLE') {
+ $(this).css({
+ 'display': 'table',
+ 'overflow': 'visible',
+ });
+
+ } else {
+ $(this).width((set_width < first_width) ? set_width : first_width);
+
+ }
+ //console.log(this.tagName+' : '+$(this).attr('nb.resize'));
+
+ }
+
+ }
+
+ });
}
}