Semantic UI Stick menu error: "Sticky: Element is Hidden, you must call refresh after element Becomes Visible "

Asked

Viewed 383 times

1

I’m using Semantic UI, and in the use of Menu Sticky, when it is "hidden" to resolutions below 630px, with the code below:

    @media all and (max-width: 630px){
    #top_menu {
        display: none;
    }
    #m_btn{
        display: inline-block;
        padding: 0px auto;
    }
}

is presented a button, until then everything works normal, but when access the site home presents the error :

"Sticky: Element is Hidden, you must call refresh after element Visible Becomes "

Would anyone know how to correct the reported error?

1 answer

1

According to the documentation, for performance reasons, the default behavior requires you to manually call the method $('.ui.sticky').sticky('refresh'); whenever the element is modified:

Sticky uses Mutation Observers to Adjust its position when content is Added to the context, and also will Automatically recalculate on browser resize, but any other changes to your page that Adjust the Elements context require you to refresh the Sticky’s position

However, there is a "definitive solution" which allows automatic updating:

$('.ui.sticky').sticky({
  context: '#exemplo',
  observeChanges: true
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.