codrops / Elastislide

Elastislide is a responsive image carousel that will adapt fluidly in a layout. It is a jQuery plugin that can be laid out horizontally or vertically with a pre-defined minimum number of shown images
362 stars 111 forks source link

minItems as fn for changing minItems on resize #2

Closed davidmarkclements closed 11 years ago

davidmarkclements commented 11 years ago

Alterations allows user to pass in either a number OR function to minItems. The function takes one parameter "ww" (window width), and must return  a number (which becomes the minItems value).

So it could look like this:

  $('#carousel').elastislide({       minItems : function (ww) { return ((ww < 480) ? 3 : (ww < 768) ? 4 : 5); }   });

So if window width is less than 480, minItems is 3, less than 768 its 4 otherwise minItems is 5.