gridstack.js icon indicating copy to clipboard operation
gridstack.js copied to clipboard

How to make GridStack vertically responsive?

Open McQuinTrix opened this issue 10 years ago • 3 comments

The plugin is responsive with width. But how can we make it responsive to height of browser?

If we want to make it to show 6 grid always whenever the person opens in any device?

McQuinTrix avatar Jan 08 '16 02:01 McQuinTrix

I solved this issue changing the line 522 in gridstack.js to :

'height: ' + ((this.opts.cell_height * (i + 1) + this.opts.vertical_margin * i))/7.7 + '%;',

and changing the 537 line in gridstack.js to :

'top: ' + ((this.opts.cell_height * i + this.opts.vertical_margin * i))/7.7 + '%;',

and in your own CSS file give property to container:

.gridstack{
   height: 100% !important;
}

now the grid will work with any height !

McQuinTrix avatar Jan 08 '16 19:01 McQuinTrix

hi @McQuinTrix , can you please specify the line number in new gridstack.js 0.2.4-dev.

is it 567 & 582 ?

Thanks.

marshmeloo avatar Jan 22 '16 20:01 marshmeloo

@marshmeloo In this file: https://github.com/troolee/gridstack.js/blob/master/src/gridstack.js

572nd line where 'height' of individual box is being set

&

587th line where 'top' is being set for individual box

But, this gave me height responsive for 3 column and 2 rows, if you want to do it for more rows you will have to tinker with the 7.7 that I am multiplying .. Hope you understand..

McQuinTrix avatar Jan 27 '16 23:01 McQuinTrix