Created
October 13, 2014 07:00
-
-
Save Walkeryr/f286f00dc130d7ef9a1f to your computer and use it in GitHub Desktop.
Window resize event to resize baron scroller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attachResizeListener: function () { | |
$(window).on('resize', this.resizer.bind(this)); | |
}, | |
resizer: function () { | |
if (this.scroller !== undefined) { | |
this.scroller.dispose(); | |
this.scroller = undefined; | |
} | |
var $wrapper = $('.wrapper'); | |
$wrapper.css('height', 'auto'); | |
$wrapper.css('height', $wrapper.outerHeight()); | |
this.scroller = baron({ | |
root: '.wrapper', | |
scroller: '.scroller', | |
bar: '.scroller__bar', | |
barOnCls: 'baron', | |
direction: 'v' | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment