Scroll to Top, Hide on Mobile - Acme Themes

Best Premium and Free WordPress Themes Forums SuperMagPro Scroll to Top, Hide on Mobile

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #4721

    The scroll-to-top seems to get in the way on mobile devices. So what I’ve done is wrote this code and added to the themes functions.php file. In most cases, you probably want to add this code to a separate plugin so you can get theme updates still or at least create a child theme. Anyways, here is the code to hide the scroll to top on mobile devices:

     * Hide scroll-to-top on mobile
    if ( wp_is_mobile() ) {
        add_action('wp_footer', 'sm_up_container');
    function sm_up_container() {
        echo "<style>.sm-up-container { display: none !important; }</style>";

    Hello icryptic,

    If you are creating child theme or plugin, we suggest you write this kinds of CSS code in separate CSS files and just enqueue it.
    Or it is just small CSS code you can just write in Custom CSS option of the theme.
    Thank you so much.

    Best Regards,
    Acme Themes

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.