Add give possibility change number item display on browser width change.

For example: 960:5,600:3, 320:2 on responsive image. This mean min-width 320 display 2 item, if 600 min-width display 3 and etc.
I create such this, but in the future i must use this module, not custom.

Comments

niko- created an issue.

CulacovPavel’s picture

@niko here is code use i, for each project maybe help to

In View style add simple textfield with description how to use.

And code

Drupal.ModuleName.adaptiveJc = function(element){
    parser = '600:5,960:8';
    var parserSplit = parser.split(',');
    var windowW = $(window).width();
    var width = element.innerWidth();
    _.each(parserSplit, function(resize){
      resize = $.trim(resize);
      var resList = resize.split(':');
      if(_.isUndefined(resList[0]) || _.isUndefined(resList[1])){
        return ;
      }
      if(windowW >= parseInt(resList[0]) ){
        width = width / parseInt(resList[1]);
      }
    }, this);
    element.jcarousel('items').css('width', width + 'px');
  }