]> git.ipfire.org Git - thirdparty/bootstrap.git/commit
Pass $element to offset top/bottom calc funcs 10359/head
authorAleksey V. Zapparov <ixti@member.fsf.org>
Mon, 2 Sep 2013 01:24:27 +0000 (03:24 +0200)
committerAleksey V. Zapparov <ixti@member.fsf.org>
Mon, 2 Sep 2013 01:24:27 +0000 (03:24 +0200)
commit626cef9fa40a3759753383ff61d5ebde32bd9a18
tree0795e5972fd97b33ca47448363146d7b2e49b55d
parent079fa16b9f067ea16995602d1da6f421ca31a191
Pass $element to offset top/bottom calc funcs

At the moment to make dynamic top offset calculator on multiple elements, one would write:

``` javascript
$('.my-affix').each(function () {
  var $el = $(this);
  $el.affix({
    offset: {
      top: function () { return $el.offset().top; }
    }
  });
})
```

This patch will allow to:

``` javascript
$('.my-affix').affix({
  offset: {
    top: function ($el) { return $el.offset().top; }
  }
});
```
js/affix.js