Feature request: make ScrollSpy's use of offset() or position() configurable.
Created by: jcheroske
I have a situation where, due to the use of absolute and relative positioning, as well as translateZ()
and scale()
, jquery's position()
is returning 0
. Because the data-spy="scroll"
element is not the <body>
, scrollspy.js is using position() and not offset(). Commenting out the following from scrollspy.js:
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
restores perfect behavior. I would like to see a scrollspy option that allows the use of either offset() or position() to be forced. (I know the offset/position thing has come up multiple times. Sorry if I'm stirring up old wounds.)