Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1473239

    Hi,

    Is there a way for the “header-scrolled” class also appear under Mobile when scrolling? I need it for a header-animation.

    Regards,
    Bernd

    #1473250

    you have to have a child-theme avia-snippet-sticky-header.js file.
    on line 79 there is:

    remove that && ! isMobile so there is only :

    if( shrinking )
    

    if you like to minify your theme script and css files – put both files ( the script itself and the minified script to a js subfolder to your child-theme. The edited script : you can minfy the code at: https://www.toptal.com/developers/javascript-minifier

    This comes to your child-theme functions.php:

    function wp_change_sticky_header_script() {
      wp_deregister_script( 'avia-sticky-header' );
    
      $vn = avia_get_theme_version();
      $options = avia_get_option();
      $child_theme_url = get_stylesheet_directory_uri();
      $min_js = avia_minify_extension( 'js' );
    
      $condition  = ( isset( $options['header_position'] ) && $options['header_position'] == 'header_top' );
      $condition2 = ( isset( $options['header_sticky'] ) && $options['header_sticky'] == 'header_sticky' ) && $condition;
      avia_enqueue_script_conditionally( $condition2 , 'avia-sticky-header-child', "{$child_theme_url}/js/avia-snippet-sticky-header{$min_js}.js", array('avia-default'), $vn, true);
    }
    add_action( 'wp_enqueue_scripts', 'wp_change_sticky_header_script', 100 );
    #1473363

    Hi Guenni007

    Thank you very much for your quick reply. It works :-)
    You can close this topic.

    Best regards
    Bernd

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Missing “header-scrolled” class under mobile’ is closed to new replies.