Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try adding this css to your <code>#search-autosuggest</code> container:</p> <pre><code>position: fixed; left: 50%; margin-left: -500px; /* Half the container's width */ </code></pre> <p><strong>Edited after feedback:</strong></p> <p>Sure it can be done with jQuery :) I'd do it by 'faking' the pushing down effect. Anyway, the effect doesn't really makes sense. You'll see it better watching it in action. Add the above styles to the <code>#search-autosuggest</code> container and use this js:</p> <pre><code>$('.sticky-header input.text').click(function () { if ($("#search-autosuggest").is(":visible")) { $("#sticky-wrapper").animate({ marginTop: '-=267' }, 500, function() { // Animation complete. }); } else { $("#sticky-wrapper").animate({ marginTop: '+=267' }, 500, function() { // Animation complete. }); window.scrollTo(0,0); } $("#search-autosuggest").slideToggle(); }); </code></pre> <p>As you can see, the content is pushed down as desired, but... You can't see the the beginning of it if you have scrolled down. If you tell me what your desired behavior is, i'll try to fix that (e.g. if you want the scroll to be on top if the input text is clicked, easy peasy).</p> <p><strong>EDIT:</strong></p> <p>To make the window scroll to the top when the users clicks the input, you need to add <code>window.scrollTo(0,0);</code> at the end of the <code>else</code> block. If you want the transition to be smooth, you can add this: <code>$('html, body').animate({ scrollTop: 0 }, 0);</code> instead of the above code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload