Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1490604

    Hi

    Is it possible to disable the fold/unfold feature for text boxes on mobile?

    I’ve noticed it takes an age to load on mobile, so resorted to duplicating content in order to load fast on mobile devices.

    kind ergards

    Duncan

    #1490611

    Hey dweddell,

    Thank you for the inquiry.

    Looks like you managed to work around this by creating a duplicate of the section with the fold/unfold option deactivated. If you still need to disable this feature on mobile, please try this css:

    @media only screen and (max-width: 768px) {
    
      /* Add your Mobile Styles here */
    
      .av-fold-unfold-container {
        max-height: max-content !important;
      }
    
      .avia-fold-unfold-section .av-fold-button-wrapper {
        display: none;
      }
    }
    

    Best regards,
    Ismael

    #1490619

    Hi Ismael

    Thanks, however this seems to hide the ‘read more’ functioanlity

    kind regards

    Duncan

    #1490642

    Hi,

    Thank you for the update.

    The read more link is no longer required since the full content is already visible. If you want to keep the link, remove this css rule.

    .avia-fold-unfold-section .av-fold-button-wrapper {
        display: none;
      }
    

    Best regards,
    Ismael

    #1490648

    Hi Ismael

    this doesn’t resolve the time it takes to load element on a mobile with the fold/unfold feature.

    is there a way the fold/unfold script/feature can be disabled on mobile?

    thanks again

    Duncan

    #1490676

    Hi,

    Try to add this code in the functions.php file to fully remove the fold/unfold script.

    function ava_remove_avia_scripts() {
        if ( wp_is_mobile() ) {
            wp_dequeue_script( 'avia-fold-unfold' );
            wp_deregister_script( 'avia-fold-unfold' );
        }
    }
    add_action( 'wp_enqueue_scripts', 'ava_remove_avia_scripts', 20 );
    

    The condition wp_is_mobile is not accurate and should only work if the page is actually being viewed on a mobile device.

    Best regards,
    Ismael

    #1490687

    Hi Ismael

    unfortunately this doesn’t work either on mobile. see page below

    kind regards

    Duncan

    #1490727

    Hi,

    Did you keep the css code? The css code is needed to fully display the content.

    Best regards,
    Ismael

    #1490733

    Hi Ismael

    ok no problem. login below

    #1490740

    see page:

    #1490801

    Hi,

    The filter we recommended was placed in the style.css file instead of the functions.php file. We removed it and added the following script instead. The text will still display with a slight delay, but the transition should now be disabled.

    add_action('wp_footer', function() {
        ?>
        <script>
        jQuery(document).ready(function($) {
            $(".avia-fold-unfold-section").each(function() {
                var $section = $(this);
                var $container = $section.find(".av-fold-unfold-container");
    
                if ($container.length) {
                    $container.css({
                        "max-height": "none",
                        "transition": "none"
                    }).removeClass("folded").addClass("unfolded");
                }
    
                var $buttonWrapper = $section.find(".av-fold-button-wrapper");
    
                if ($buttonWrapper.length) {
                    $buttonWrapper.css("display", "none");
                }
            });
        });
        </script>
        <?php
    }, 999);
    
    

    We also edited the modification in the Quick CSS field.

    @media only screen and (max-width: 768px) {
      .av-fold-unfold-container {
        max-height: none !important;
        transition: none !important;
        opacity: 1 !important;
      }
    
      .avia-fold-unfold-section .av-fold-button-wrapper,
      .av-fold-button-container {
        display: none !important;
      }
    
      #top .avia-fold-unfold-section .av-fold-unfold-container:after {
        display: none !important;
      }
    
      .avia-fold-init,
      .avia-fold-init-done {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
      }
    }
    

    Best regards,
    Ismael

    #1490890

    Hi Ismael

    Thanks, however this affected the ‘read more’ functionality for screens over 768px.

    removed snippet. I think we’ll leave it for the time being

    really appreciate time spent on this

    kind ergards

    Duncan

    #1490901

    Hi,

    We adjusted the script slightly and added a condition so it only applies when the screen width is equal to or less than 767px. Please edit the functions.php file and replace the script with this code:

    add_action('wp_footer', function() {
        ?>
        <script>
        jQuery(document).ready(function($) {
            if (window.innerWidth <= 767) {
                $(".avia-fold-unfold-section").each(function() {
                    var $section = $(this);
                    var $container = $section.find(".av-fold-unfold-container");
    
                    if ($container.length) {
                        $container.css({
                            "max-height": "none",
                            "transition": "none"
                        }).removeClass("folded").addClass("unfolded");
                    }
    
                    var $buttonWrapper = $section.find(".av-fold-button-wrapper");
    
                    if ($buttonWrapper.length) {
                        $buttonWrapper.css("display", "none");
                    }
                });
            }
        });
        </script>
        <?php
    }, 999);
    

    Best regards,
    Ismael

    #1490979

    Awesome :)

    Many thanks for sorting this out. working a treat now

    kind ergards

    Duncan

    #1490984

    Hi,
    Glad that Ismael could help, if you have further questions please open a new thread and we will try to help. Thanks for using Enfold.

    Best regards,
    Mike

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘fold/unfold disable on mobile’ is closed to new replies.