Okay
  Public Ticket #3746472
Sticky column on mobile
Open

Comments

  •  28
    Co-Brains started the conversation

    Hi!

    I have set the column with the title "Chi siamo" to be sticky, and as you can see on desktop, it works correctly. However, I noticed that on mobile (tablet too), the column is not sticky.

    I would like to know if it's possible to make the column sticky on mobile as well, maintaining the same functionality as on desktop.

    Thank you 

    have a nice day


  •  8,856
    Tahir replied

    Hey Again,

    Thanks for reaching out! .

    Add this into the Custom CSS box in your Salient Theme Options panel (We write all Custom CSS in the Live Browser to ensure accuracy. If you cannot see any changes, make sure there is no red cross in the Custom CSS Box as any syntax error would cause all CSS under that line of code to not show up on the Frontend):

    @media only screen and (min-width: 1px) and (max-width: 999px) {
        .n-sticky.theiaStickySidebar {
            position: fixed !important;
            width: auto !important;
            left: 0px !important;
        }
    }
    
    

    Let me know if this helps! Happy to assist further if needed.

    Best,

     


    ThemeNectar Support Team 

  •  28
    Co-Brains replied

    It didn't work. I tried to remove the "theiaStickySidebar" class since i didn't find that in the html of the page, but in that way the titles disappear. if you want to check the page i leave the css that make the titles disappear

  •  8,856
    Tahir replied

    Hey Again,

    Here’s what you can try:

    @media only screen and (min-width: 1px) and (max-width: 999px) {
        .nectar-sticky-column {
            position: fixed !important;
            width: auto !important;
            left: 0px !important;
        }
    }

     

    Best,

     


    ThemeNectar Support Team 

  •  28
    Co-Brains replied

    i'm sorry, but as you can see the page is broken in this way. i think that something with the js that add the sticky class is not working properly.

  •  8,856
    Tahir replied

    Hey Again,

    The JS code does not get enabled in Mobile screen sizes , to confirm this try refreshing the page after switching to mobile width in the browser.

    At the moment there is no such JS code to enable the sticky feature for mobile the same as Desktop. 

    However have noted it in the wishlist. 

    Best 

     


    ThemeNectar Support Team 

  •  28
    Co-Brains replied

    okay, thank you. but for now, how can i fix this issue?

  •  8,856
    Tahir replied

    Try the below CSS solution.

    You will have to refresh the page if you are resizing the browser to the mobile width and testing.

    Add this into the Custom CSS box in your Salient Theme Options panel (We write all Custom CSS in the Live Browser to ensure accuracy. If you cannot see any changes, make sure there is no red cross in the Custom CSS Box as any syntax error would cause all CSS under that line of code to not show up on the Frontend):

    @media only screen and (min-width: 1px) and (max-width: 999px) {
        .nectar-sticky-column {
            position: fixed !important;
            width: auto !important;
            left: 0px !important;
        }
    }
    

    Thanks


    ThemeNectar Support Team 

  •  28
    Co-Brains replied

    as I told you before, in this way the headers will be fixed on the page. this is problematic: if you look down the page, there are more than one. they are in fact sticky solely within the row, not across the page

    thank you

  •  8,856
    Tahir replied

    In that case I am afraid the sticky columns cant be replicated on mobile using CSS alone. 

    Best 


    ThemeNectar Support Team 

  •  28
    Co-Brains replied

    how can i do then not using css?

    thank you

  •  8,856
    Tahir replied

    Try switching to the CSS powered featured so we can try and write up custom css for it: 8316782863.png

     

    Best,

     


    ThemeNectar Support Team 

  •  28
    Co-Brains replied

    Hi!

    It's already CSS powered sticky

  •  1,882
    Judith replied

    Hi there,

    Thanks for writing back.

    To assist you better, we'd love to have a closer look at your setup and to do this, we'll need admin login credentials 

    (dashboard URL, username, password) to your site. This will enable us to conduct a more in-depth investigation of the issue based on your specific configurations. Would you mind sharing this with us? 

    If you prefer, you can safely share the access through an access plugin such as Controlled Admin Access.

    Before you provide this information, we strongly recommend taking a backup of your site.

    If you have any concerns or questions about this process, please don't hesitate to let me know.

    Best regards,

  •   Co-Brains replied privately
  •  1,882
    Judith replied

    Hi there,

    Thanks for writing back.

    Try adding the JS code as a workaround:

    jQuery(document).ready(function($) {
        function makeSticky() {
            var element = $(".n-sticky");
            var parentContainer = $(".nectar-sticky-column-css");
    
            if (element.length > 0 && parentContainer.length > 0) {
                var elementTop = element.offset().top;
                var stickyTop = 50; // Adjust this value as needed
                var elementWidth = element.outerWidth(); // Get the element's width
                var parentBottom = parentContainer.offset().top + parentContainer.outerHeight();
                var marginBottom = 10; // Space before the end of the parent container
    
                var checkSticky = function() {
                    var windowWidth = $(window).width();
                    var scrollTop = $(window).scrollTop();
    
                    if (windowWidth >= 690 && windowWidth < 1000) {
                        if (scrollTop + stickyTop >= elementTop && scrollTop + stickyTop + element.outerHeight() < parentBottom - marginBottom) {
                            element.css({
                                'position': 'fixed',
                                'top': stickyTop + 'px',
                                'width': elementWidth + 'px', // Set the width
                                'z-index': '10'
                            });
                        } else if (scrollTop + stickyTop + element.outerHeight() >= parentBottom - marginBottom) {
                            element.css({
                                'position': 'absolute',
                                'top': (parentBottom - element.outerHeight() - marginBottom - parentContainer.offset().top) + 'px',
                                'width': elementWidth + 'px', // Set the width
                                'z-index': '10'
                            });
                        } else {
                            element.css({
                                'position': '',
                                'top': '',
                                'width': '', // Reset the width
                                'z-index': ''
                            });
                        }
                    } else {
                        element.css({
                            'position': '',
                            'top': '',
                            'width': '', // Reset the width
                            'z-index': ''
                        });
                    }
                };
    
                $(window).on('scroll', checkSticky);
                $(window).on('resize', function() {
                    elementTop = element.offset().top;
                    elementWidth = element.outerWidth(); // Update the element's width on resize
                    parentBottom = parentContainer.offset().top + parentContainer.outerHeight();
                    checkSticky(); // Recalculate sticky behavior on resize
                });
    
                // Initial check
                checkSticky();
            }
        }
    
        // Initial call to make the element sticky
        makeSticky();
    });
    
    

    This is a one-time exception as providing custom code support is beyond our scope of support.

    Also, the sticky column by design does not apply for view ports above 1000px.

    I really hope this proves helpful for you. If you have any more questions or run into any problems, please feel free to reach out.

    Best regards,

  •  28
    Co-Brains replied

    Hi Judit,

    Thank you for the suggested workaround; it does help, but unfortunately, it's not fully resolving the issue. As I mentioned earlier, I have multiple sticky titles on the page, but with the current JS, they all appear stacked on top of each other (please see the attached screenshot).

    Additionally, I find it a bit concerning that the sticky functionality doesn’t seem to carry over to mobile devices, and there was no clear indication of this limitation. It would be very helpful if there will be a way to maintain the sticky feature across all platforms.

    Thank you

    Attached files:  Screenshot 2024-10-21 alle 9.54.12 AM.png

  •  1,882
    Judith replied

    Hello there,

    Thanks for writing back.

    Thanks for pointing this out, we've taken note of this as an area of improvement.

    If you have any more questions or run into any problems, please feel free to reach out.

    Best regards,

     

  •  28
    Co-Brains replied

    Hi Judit,

    Thank you for your reply and for acknowledging the issue. I appreciate your attention to this. However, the problem with the sticky titles remains unresolved, and it's quite important for the layout of my page. Could you please advise if there's a way to address this, or if there are any plans to update the CSS/JS to handle multiple sticky elements correctly across both desktop and mobile?

    I’d really appreciate any further assistance you can provide on this matter.

    Thank you in advance for your help

  •  1,882
    Judith replied

    Hi there,

    Thanks for writing back.

    At the moment we don't have these options for mobile viewport as it may require code customization which is beyond our scope of support.

    However, we are partnered with a trusted provider of expert-level Salient customization. If you are interested in initiating a project, we recommend referring to our guide at the following link: https://themenectar.com/salient/customization/

    In the meantime, please don't hesitate to reach out with further questions. We're happy to help.

  •  28
    Co-Brains replied

    Hi Judit!

    I understand that custom code can sometimes be required for additional functionality, but in this case, sticky elements are expected to work across all devices, including mobile, by default. There doesn't seem to be a valid technical reason why this feature should only work on desktop viewports. It is a core function of sticky elements, and it should be consistent across different screen sizes without needing customization.

    I kindly request that this issue be addressed and resolved in the next theme update, as it is an essential function for mobile usability.

    Thank you

    Co-brains Team

  •  2,966
    Andrew replied

    Hi again,

    Thank you for getting back to us.

    Allow me to escalate this to the developer for further advise.

    We highly appreciate your patience on this matter.

    Kind regards,

  •  28
    Co-Brains replied

    Hi Andrew!

    Okay, I'll be waiting to hear from you then

    Thank you 
    Co-brains Team

  •  1,077
    ThemeNectar replied

    Hey Co-Brains,

    We do not have plans to enable sticky positioning on mobile by default, however I've noted the idea for an option to do that. For now, you can accomplish that by adding the following snippet into the custom CSS box located in the Salient options panel > General Settings > CSS/Script related tab:

    @media only screen and (min-width: 1px) and (max-width: 999px) {
        html body {
            overflow: visible;
        }
        .vc_row:not(.vc_row-o-equal-height) .nectar-sticky-column-css.vc_column_container > .n-sticky {
            height: 100%;
        }
        .nectar-sticky-column-css.vc_column_container > .n-sticky > .vc_column-inner {
            position: sticky;
            top: var(--nectar-sticky-top-distance);
       }
    }

    Kind regards

  •  28
    Co-Brains replied

    Thanks! It seems to work correctly! 

    I hope you will implement this feature in the future because in many occasions it is useful to have sticky elements even from mobile

    Thanks again
    Co-brains Team