Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1055450

    Hello
    I want to put a sidebar on top of a page on mobile screen.
    The sidebar is put on bottom of the page automatically.

    I checked a past post below and tried same, but it doesn’t work.

    This is URL.
    https://sindb.com/online_shop

    Will you tell me how to do that?

    Thank you
    Shoko

    #1055465

    if you only want that for mobile do this to functions.php of your child-theme
    if you like to have it for small screens you have to work with a different if clause ( if ($(window).width() < 768) {

    function change_position(){
    if(wp_is_mobile()){
    ?>
    <script>
    (function($){
    	$('aside').insertBefore('main.content');
    })(jQuery);
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'change_position');

    PS: to work with the flex-box model is also a good idea.

    • This reply was modified 5 years, 10 months ago by Guenni007.
    #1055467

    this is better – and comes to quick css:

    @media only screen and (max-width:767px) {
      .responsive #top.woocommerce-page #main .sidebar {
        display: block;
        border-color: transparent;
      }
    
      .responsive #top.woocommerce-page #main .sidebar .inner_sidebar {
        margin-left: 0;
      }
    
      .responsive #top.woocommerce-page #wrap_all .container_wrap_first .container {
        display: flex;
        flex-direction: column-reverse;
      }
    }
    #1055543

    Hello Guenni007

    Thank you for your great help!
    It works properly!

    Thank you again.
    Shoko

    #1055915

    Thanks too for the positive feedback

    #1056040

    Hi Shoko,

    Great, glad you got it working and thanks to @guenni007 for helping out :-)

    Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1056073

    Hi Rikard

    Please close this topic.
    Thank you
    Shoko

    #1056391

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Enfold: how to put a sidebar on top of a page on mobile screen.’ is closed to new replies.