ngSticky
ngSticky copied to clipboard
Sticky breaking when hiding (in a tabbed layout)
The sticky becomes corrupt when you change tabs and come back to a tab with the sticky.
This can be fixed as follows;
}, function(newVal, oldVal) {
if ( newVal !== oldVal && newVal !== 0 || typeof stickyLine === 'undefined' ) {
// STEMN changes - added newVal !== 0 so sticky does not get defined to zero when tab is changed
stickyLine = newVal - offset;
checkIfShouldStick();
}
});
Hey @DaveRevay2, but what happens when newVal is genuinely 0? Is that case possible?
New val become zero when the section is hidden in an ng-hide/show
Hello,
This fix works on my project where my HTML element with the sticky is initially hidden by the ngHide directive (ie. #45).
The problem happens again, when there are several sticky directive on the same view (with only one showed ;-)).
See my example on version 1.7.9.
Therefore, the fix is :
if (( newVal !== oldVal || typeof stickyLine === 'undefined' ) && newVal !== 0) {
Ran into the same problem using ng-show. The above fix worked. Will this fix be added to the repo?