• Resolved Allinop

    (@aboutm2)


    Hi,

    Regarding the position of the submenu box where the live search results appear.

    As it stands, when one scrolls down then this submenu box with the live results moves along instead of remaining sticky to the search bar above.

    Is there a way to fix this?

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes. Add this to your theme functions.php:

    add_filter( 'relevanssi_live_search_configs', function( $configs ) {
        $configs['default']['results']['static_offset'] = false;
        return $configs;
    } );
    Thread Starter Allinop

    (@aboutm2)

    Hi, thank you for your message.

    Tried it but did not work.

    I have the following CSS to make the primary navigation/search bar appear only on scrolling down. Is it possible this is causing a conflict?

    Is there a way to fix this?

    .home nav#mobile-header:not(.is_stuck) .inside-navigation.grid-container.grid-parent, .home .main-navigation:not(.is_stuck) {
    display: none;
    }

    • This reply was modified 1 year, 9 months ago by Allinop.
    • This reply was modified 1 year, 9 months ago by Allinop.
    • This reply was modified 1 year, 9 months ago by Allinop.
    Plugin Author Mikko Saari

    (@msaari)

    The problem is that the results box is not in the search bar; it’s at the bottom of the page.

    Did you have to use add_filter( 'relevanssi_live_search_add_result_div', '__return_false' ); to get the search working in the first place? Not using that would be good.

    I tried moving the results element inside the form tag of the search form, and that worked: that way the search results element stays sticky at the top of the page.

    Thread Starter Allinop

    (@aboutm2)

    EDIT: no i did not have to use that one.

    To clarify, I want the submenu of live searches to remain sticky not only when I scroll through the submenu itself but also when I scroll through the rest of the page.

    You can see an example the effect I am trying to achieve on the following website: example – Google Search

    • This reply was modified 1 year, 9 months ago by Allinop.
    • This reply was modified 1 year, 9 months ago by Allinop.
    Thread Starter Allinop

    (@aboutm2)

    I do apologize, I am not sure I understand how to fix this. I am trying to get the submenu live search sticky when scrolling through the rest of the page or when I scroll through the submenu itself

    Plugin Author Mikko Saari

    (@msaari)

    The results element is at the bottom of the page. If it were in the search form, this would work correctly.

    Now, by default, Relevanssi places the results element inside the form. That’s why I was asking about the filter function, which would set this up the way it is now.

    Where is the search form coming from? Does your theme have a searchform.php file that contains the search form? If it does, it’s possible to modify the searchform.php so that the results element appears inside the search form and sticks correctly.

    Thread Starter Allinop

    (@aboutm2)

    Hi, I have now disabled the:

    add_filter( 'relevanssi_live_search_add_result_div', '__return_false' );

    The sticky now works fine so that’s sorted.

    The only minor issue that remains is that the submenu is not aligned very well, it goes off further to the right side. The above filter corrected it but caused the submenu not being sticky, so now is deactivated

    • This reply was modified 1 year, 9 months ago by Allinop.
    Plugin Author Mikko Saari

    (@msaari)

    Try this in your CSS:

    #rlvlive_2 {
        left: -315px;
        position: relative;
        top: -50px;
    }
    Thread Starter Allinop

    (@aboutm2)

    Thank you, it now works perfectly!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Submenu results – make sticky’ is closed to new replies.