• Resolved Sarah Amft

    (@timblitz)


    Hi Tobias,

    we have installed the fixed header plugin extension and have an issue with it:
    For mobile, we need the offset to be at 80 – and for desktop at 0. Is there an inbuilt solution for this or css workaround?

    Thank you very much, Tim

    PS: we have been using your plugin for years – and absolutely love it! Robust, clean and realiable. Just rated and donated.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, this is possible. For example, set the offset to 0 (as a the default), and then add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    @media screen and (max-width: 767px) {
        .tablepress.fixedHeader-floating {
            top: 80px !important;
        }
    }

    This will set the offset to 80 pixels for small screens.

    Regards,
    Tobias

    Thread Starter Sarah Amft

    (@timblitz)

    Hi Tobias,

    thank you very much – works like a charme ??

    Any ideas of how to implement this for all tables at once (instead of having to implement it via shortcode for each table). We have hundreds of tables…

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    Do you mean the FixedHeader Extension? For that, you could add this to the “functions.php” file of your theme. It essentially sets the default parameters for the FixedHeader.

    add_filter( 'tablepress_table_render_options', 'tp_turn_on_fixedheader', 10, 2 );
    function tp_turn_on_fixedheader( $render_options, $table ) {
      $render_options['datatables_fixedheader'] = 'top';
      return $render_options;
    }

    Regards,
    Tobias

    Thread Starter Sarah Amft

    (@timblitz)

    Thanks Tobias.

    Works perfectly. We have another issue though…

    The extension only works if the Javascript Library tickbox in the configuration of the respective table is activated. To avoid that we have to tick all these tickboxes now manually: is there an easy workaround to this as well?

    Thanks so much for your help

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    good to hear that this helped!

    Indeed, the “Use DataTables” checkbox needs to be active for this. We could in principle activate it in the same way as the FixedHeader. However, this could have a drawback: It would also (unless you had turned those off manually in the past) the checkboxes for search, pagination, etc. Then again, we could turn these off in the same way with a few extra lines of code, but that could have a different drawback: It would turn it off everywhere, so that you would lose flexibility if you (now already or in the future) want to use these features with e.g. just a subset of tables…

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different offset for mobile vs desktop with fixed header’ is closed to new replies.