lundi 29 juin 2015

scrolltofixed - limit next item

scrolltofixed plugin does not seem to be changing to the next item in the list. See code below: http://ift.tt/1HtOSDZ

var learningObjectives = $('.learning-objective-header');
learningObjectives.each(function(i) {
  var learningObjective = $(learningObjectives[i]);
  var next = learningObjectives[i + 1];

  learningObjective.scrollToFixed({
    marginTop: 137,
    limit: function() {
      var limit = 0;
      if (next) {
        limit = $(next).offset().top - $(this).outerHeight(true);
      }
      return limit;
    }
  });
});

Aucun commentaire:

Enregistrer un commentaire