kombai / freewall

Freewall is a cross-browser and responsive jQuery plugin to help you create grid, image and masonry layouts for desktop, mobile, and tablet...
MIT License
1.85k stars 375 forks source link

Block collapsing on resize #191

Closed KeshaFinkel closed 9 years ago

KeshaFinkel commented 9 years ago

Some block collapsing to width 0 when i resize window maybe i did something wrong?

                    wall.reset({
                      draggable: false,
                        cache: false,
                      selector: '.cell',
                      animate: false,
                      cellW: function(){
                          var boxWitdth = 160;
                          if($(window).width() < 330) {
                              var cells = $('#freewall').find('.cell');
                              $.each(cells,function(i,val) {
                                  $(val).attr('data-width',160);
                              });
                          }  else if($(window).width() < 755){
                              boxWitdth = Math.floor(document.getElementById('freewall').offsetWidth/2);
                          }else if($(window).width() < 1011){
                              boxWitdth = Math.floor(document.getElementById('freewall').offsetWidth/3);
                          }else if($(window).width() < 1267){
                              boxWitdth = Math.floor(document.getElementById('freewall').offsetWidth/4);
                          } else {
                              boxWitdth = Math.floor(document.getElementById('freewall').offsetWidth/5);
                          }
                            console.log("Box width:" + boxWitdth);
                            return boxWitdth;
                          },
                      cellH: function(){
                          var boxHeight = 160;
                          if($(window).width() < 330) {
                              var cells = $('#freewall').find('.cell');
                              $.each(cells,function(i,val) {
                                  $(val).attr('data-height',160);
                                });
                          } else if($(window).width() < 768){
                              boxHeight = Math.floor(document.getElementById('freewall').offsetWidth/2);
                          }else if($(window).width() < 1024){
                              boxHeight = Math.floor(document.getElementById('freewall').offsetWidth/3);
                          }else if($(window).width() < 1280){
                              boxHeight = Math.floor(document.getElementById('freewall').offsetWidth/4);
                          } else {
                              boxHeight = Math.floor(document.getElementById('freewall').offsetWidth/5);
                          }
                          console.log("Box width:" + boxHeight);
                          return boxHeight;
                          },
                      gutterX: 0,
                      gutterY: 0,
                      onResize: function() {
                          wall.fitWidth();
                          wall.refresh();
                      }
                    });

u can see it here: http://badlab.ru/

kombai commented 9 years ago

Hi, Could you please set cacheSize: false intead of cache: false.

KeshaFinkel commented 9 years ago

Omg that option totally ruined grid layout joxi_screenshot_1443766130742

KeshaFinkel commented 9 years ago

my failure, got some elements positioned manually