0

I have this situation:

I have a header and on the top is a top bar, in the middle is the logo. On scroll the logo will disappear, and here the problem.

I have a css top on 54px, but the top bar height is dynamic, based on device, so a space is created between the header and the topbar.

On scroll a new class is added on my header : .x-navbar-fixed-top.

So I want to check if on this static class : .x-navbar is added this class: .x-navbar-fixed-top. So if it is I have to add this let heightTop = jQuery('.topBarTitle').height(); if not, i don't.

I try this :

 jQuery('.x-navbar').change( function() {
        console.log('ok');
        let heightTop = jQuery('.topBarTitle').height();
        jQuery('.x-navbar-fixed-top').attr('style','top:'+heightTop+'px!important;');
    });

It dosen't works. I don't want to use setTimout or similar, just events.

Cristian
  • 424
  • 3
  • 14

0 Answers0