Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #1409040

    Ive tried https://kriesi.at/support/topic/show-different-logo-in-head-upon-scrolldown/ and other solutions I was able to find on the forums (like Guenni007’s different function/css) but none are working. The closest I can get is to show both the default logo and the logo I defined or scrolling, but both are showing.

    I am looking for a definitive way to show a completely different logo when sticky/shrinking header. Thanks in advance for any help!

    #1409050

    Your topic of that is the way i understand – different logo during scrolling – stop scrolling default logo:

    the method used for your aim depends on the logos you like to use.
    E.g. – Logo a and logo b are only colored differently (change of font color – change of branding color etc.). I would try to realize it by an svg logo just switching the fill colors by scroll event.
    Etc.

    F.e. two logo variants are by same dimensions. Insert your logo as usual – and set on quick css the other logo as background-image.
    on my example page these are svg files – but png or jpg is also a possibility.

    .av-contains-svg.invisible  {
      background-image: url(/wp-content/uploads/icon807.svg);
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center center;
    }
    
    .av-contains-svg.invisible svg {
      opacity: 0;
      transition: opacity 1s ease-in-out
    }

    the jQuery function now on child-theme functions.php:

    function invisible_on_scrolling() { 
    ?>
    <script type="text/javascript">
    (function($){
      let timeout;
      let $targetOnScroll = $('.av-contains-svg');
    
      $(document).on("scroll", () => {
        $targetOnScroll.addClass("invisible");
        clearTimeout(timeout);
        timeout = setTimeout(() => $targetOnScroll.removeClass('invisible'), 200);
      });
    })(jQuery);
    </script>
    <?php 
    }
    add_action('wp_footer', 'invisible_on_scrolling');

    see: https://webers-web.info/datenschutz/

    Or: do you like to have different logo during shrink – after shrink finished – default logo
    can you link to my post that you are referring to?

    #1409054

    Thank you @Guenni007 – as mentioned, I am hoping to show a completely different logo when the sticky/shrinking header is being used. I did put your solution in place to test an on scrolling it is showing the alternate logo, but once I stop scrolling the initial logo (the one I want to replace when the sticky/shrinking header is enabled) shows again.

    When I use the sticky and/or shrinking header and start to scroll down the page, I want to display a completely different logo.

    #1409067

    But that’s what it sounds to me when it’s said: different logos on scroll ( means during the scroll ).

    if you want to show logo A only when loading the page – and while scrolling to the end of the shrunk header. After reaching the shrunk height of the header, logo B should be visible.
    This is analogous to the transparency header – but now with the same behavior on all pages.

    It would be best if we could see your logos to get an idea of what we have to work with.

    #1409069

    Your solution did show the logo ‘during’ the scroll, but when I stoped scrolling – even though the header was shrunk and scrolled to the lower part of the page I was on – the original logo shows again and the logo I want to show in a shrunk/scrolled header is no longer visible.

    Can you see hidden content in this ticket?

    Thanks!

    #1409086

    Hi,

    Please provide the link to the site so that we can inspect it and make the necessary adjustments. Screenshots will also help. You can use platforms like Savvyify, Imgur or Dropbox to upload and share the screenshot. Here are the steps to follow:

    1.) Visit the website of your chosen platform, such as Savvyify, Imgur or Dropbox.
    2.) Locate the option to upload a file or an image.
    3.) Select the screenshot file from your computer or device and upload it to the platform.
    4.) After the upload is complete, you will be provided with a shareable link or an embed code.
    5.) Copy the link or code and include it in your message or response to provide us with the screenshot.

    Thank you for taking the time to share the screenshot. It will help us better understand the issue you’re facing and provide appropriate assistance.

    Best regards,
    Ismael

    #1409093

    so look again to the example page: https://webers-web.info/

    This is default behavior on transparency pages – showing first the logo (from options : header – transprency options – transparency logo) after shrinking finished the default logo is shown.

    And that is what you like to have on all pages – even those with header option : not transprency.

    #1409197

    @Guenni007, that is what I want. I would like to know how to put this in place though without the transparent header. I don’t want sliders all the way on top on my pages if I can help it. I did set the logo I want users to see when scrolling as the transparency logo, but just so I can show which logo I am looking to use in that case. I’ll out everything in the private content space now…

    #1409421

    Curious if Enfold support has seen the private data and had any suggestions?

    #1409423

    what kind of mime type are your logos? png / jpg / svg ?

    #1409424

    SVG

    #1409425

    do you need inline svg for that alternative logo – or is a img src ok?
    see: https://webers-web.info/impressum/

    the trick will be to insert another subtext logo. But this logo is not in dependency to av_header_transparency but to header-scrolled class.

    Edit: just a moment – i had to optimize the codes

    #1409432

    https://webers-web.info/impressum/ is exactly what I’m after. I can only click that link in your reply, not sure if the others are supposed to link?

    #1409434

    hm – my coding abilities are not good enought to check in a filter function if a page/post is a transparency page.
    i see that line on enfold-functions.php :

    $transparency = post_password_required() ? false : get_post_meta( $post_id, 'header_transparency', true );
    

    but can’t get it to run for all non transparency pages/posts

    what i got so far for my example page is:

    function an_alternative_logo( $sub ) {
    	if (is_page(2879) ) {
    		$sub .= '<img class="alternative-logo" src="path_to_your_alternative_logo" alt="alternativ Logo" />';
    	}
    	return $sub;
    }
    add_filter( 'avf_logo_subtext', 'an_alternative_logo' );
    
    function replace_alternative_svg_logo_with_inline_code() { 
    if (is_page(2879) ) {
    ?>
    <script type="text/javascript">
    window.addEventListener("DOMContentLoaded", function () { 
    	(function($){
    		$( ".avia-img-svg-logo-sub img" ).remove();
    		$.get('path_to_your_alternative_svg_logo', function(svg){
    		  $( ".avia-img-svg-logo-sub" ).html( svg );
    		}, 'text');
    	})(jQuery);
    });	
    </script>
    <?php 
    }
    }
    add_action('wp_footer', 'replace_alternative_svg_logo_with_inline_code');

    and for quick css:

    #top.page-id-2879 .alternative-logo {
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;
      transition: opacity 0.5s ease
    }
    
    #top.page-id-2879  .header-scrolled .alternative-logo {
      opacity: 1;
    }
    
    #top.page-id-2879 .header-scrolled .av-contains-svg > svg,
    #top.page-id-2879 .header-scrolled .av-contains-svg > img {
      opacity: 0;
      transition: opacity 0.5s ease
    }
    
    #top.page-id-2879 .subtext.avia-img-svg-logo-sub > svg {
      position: absolute;
      top: 0;
      left: 0;
    }
    
    #top.page-id-2879 :not(.header-scrolled) .subtext.avia-img-svg-logo-sub > svg {
      opacity: 0;
      transition: opacity 0.5s ease
    }
    
    #top.page-id-2879  .header-scrolled .subtext.avia-img-svg-logo-sub > svg {
      opacity: 1;
      transition: opacity 0.5s ease
    }

    maybe it is possible for a mod to change the code for a more global use, in the sense that only pages without transparent logo will have this filter.

    #1409440

    Supposed to rain here all weekend and I’ll give this a shot and try to get it working on all pages. Thanks!

    #1409444

    Hi,
    Glad Guenni007 could help, thank you Guenni007, let us know if you need any further help or if we should close this thread.

    Best regards,
    Mike

    #1409458

    Yes mike – but this is half the solution it could be.
    Better would be :

    maybe it is possible for a mod to change the code for a more global use, in the sense that only pages without transparent logo will have this filter.

    #1409550

    Hi,
    Thanks Guenni007 I took a look at this and at lzevon’s site and I found that it works for this site even though it is not using a transparent header.
    lzevon thanks for the login I see that are are using a page ID to your homepage for the css and script so it will only work on your homepage and this page is not transparent and uses the Shrinking Header & Sticky Header, I checked the code from Guenni007 and added a svg image all-for-you-no-cloud.svg in the placeholder path_to_your_alternative_svg_logo in the code.
    So now the logo with the cloud shows at the top of the page and before scroll, then after scroll the logo with no cloud shows.
    Please see the screenshots in the Private Content area and clear your browser cache and check.

    Best regards,
    Mike

    #1409630

    Thanks Mike, the logo script from @GUENNI007 was a great starting point, it’s now site-wide and was simplified to:

    function an_alternative_logo( $sub ) {
    	$sub .= '<img class="alternative-logo" src="/wp-content/uploads/2023/05/blah.svg" />';
    	return $sub;
    }
    add_filter( 'avf_logo_subtext', 'an_alternative_logo' );

    We’re using the following CSS…

    /* swap logo */
    #top img.alternative-logo {
        display: none;
    }
    
    @media only screen and (min-width:767.1px) {
        #top .header-scrolled .avia-svg-logo > a > svg {
            opacity: 0;
            height: 0;
            overflow: hidden;
            transition: opacity 0.5s ease;
        }
    
        #top img.alternative-logo {
            display: block;
            opacity: 0;
            height: 0 !important;
            overflow: hidden;
            transition: opacity 0.5s ease;
        }
    
        #top .header-scrolled img.alternative-logo {
            width: 100%;
            height: 39px !important;
            opacity: 1;
        }
    
        #top .header-scrolled .avia-img-svg-logo-sub {
            height: 100%;
            display: flex;
            align-items: center;
        }
    }

    Hope this helps someone else looking for similar functionality.

    • This reply was modified 1 year, 6 months ago by lzevon.
    #1409651

    Hi,
    Glad Guenni007 could help, thank you Guenni007, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 20 posts - 1 through 20 (of 20 total)
  • The topic ‘working solution for different logo on scroll’ is closed to new replies.