            itemMargin: 5,
                  minItems: getGridSize(), // use function to pull in initial value
                  maxItems: getGridSize() // use function to pull in initial value
                });
              });

              // check grid size on resize event
              $window.resize(function() {
                var gridSize = getGridSize();

                flexslider.vars.minItems = gridSize;
                flexslider.vars.maxItems = gridSize;
              });
            }());