ngSticky icon indicating copy to clipboard operation
ngSticky copied to clipboard

Sticky breaking when hiding (in a tabbed layout)

Open MrBlenny opened this issue 10 years ago • 5 comments

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();
                }
            });

MrBlenny avatar Feb 15 '15 03:02 MrBlenny

Hey @DaveRevay2, but what happens when newVal is genuinely 0? Is that case possible?

d-oliveros avatar Feb 24 '15 07:02 d-oliveros

New val become zero when the section is hidden in an ng-hide/show

MrBlenny avatar Feb 24 '15 07:02 MrBlenny

Hello,

This fix works on my project where my HTML element with the sticky is initially hidden by the ngHide directive (ie. #45).

grrseguin avatar Jun 05 '15 06:06 grrseguin

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) {

grrseguin avatar Jun 12 '15 09:06 grrseguin

Ran into the same problem using ng-show. The above fix worked. Will this fix be added to the repo?

tyleralmond avatar Jul 02 '15 16:07 tyleralmond