Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1239894
    brianjohnsondesign
    Participant

    Hey guys,

    I have a simple problem that I’m confident is an X-Theme related bug. On mobile, users are unable to click the “comment” button on comments and other activity within Buddypress. It simply scrolls up the screen a little bit. Every so often it works but it’s rare.

    Here is why I believe this is an X Theme bug:

    1. It’s not an issue with other themes. It works fine with them.
    2. X Theme touts its perfect compatibility with BuddyPress.
    3. I’m not the only one with this problem. See the following posts which weren’t really resolved; the first person had to hack it and the second person never reported a fix:

    https://community.theme.co/forums/topic/please-point-me-in-the-right-direction-xbuddypressmobilecomment/
    https://community.theme.co/forums/topic/buddypress-cant-comment-on-mobile-and-buggy/

    I’m using the renew stack, and have tried disabling everything except buddypress and cornerstone and literally not had any customization of any kind.

    It’s happened for me exactly the same way on numerous android devices, haven’t been able to test it on mobile.

    I recommend testing it on your own website with BuddyPress; I believe it will confirm that the problem lies with the Theme.

    #1240328
    Christopher
    Moderator

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1247214
    brianjohnsondesign
    Participant
    This reply has been marked as private.
    #1247442
    Nabeel A
    Moderator

    Hi again,

    Thanks for providing the URL. Can you please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    Let us know how this goes!

    #1247819
    brianjohnsondesign
    Participant

    Yep, I already did that as mentioned in my original post. I disabled every plugin other than Buddypress and Cornerstone and also used the default version of X Theme, nothing custom at all.

    Same problem. Problem goes away if I use a different theme.

    Again, I don’t believe this is a local problem, I’m pretty sure it’s a bug. You could confirm it by testing it on your own setup.

    #1248424
    Christian
    Moderator

    Hey Brian,

    I confirm this is a bug. This is due to a script in X which targets links with fragment identifier to scroll up when clicked. There’s currently no solution to this.

    We’re sorry for the inconvenience. I’ll forward this to our development team.

    Thanks for reporting.

    #1249325
    brianjohnsondesign
    Participant

    Thank you for confirming this.

    Do you know the name of the script? Can it be disabled?

    I can easily write the conditional code needed to disable it only on the buddypress pages, but I could use some direction with which script I’m disabling!

    #1249689
    Paul R
    Moderator

    Hi,

    To fix it, you can try adding this in your Custom > Edit Global Javascript

    
    jQuery(document).ready(function($) {
      $('a[href*="#"]').off('touchend click');
      var $body                = $('body');
      var bodyHeight           = $body.outerHeight();
      var adminbarHeight       = $('#wpadminbar').outerHeight();
      var navbarFixedTopHeight = $('.x-navbar-fixed-top-active .x-navbar').outerHeight();
      var locHref              = location.href;
      var locHashIndex         = locHref.indexOf('#');
      var locHash              = locHref.substr(locHashIndex);
      var dragging             = false;
      
      $body.on('touchmove', function() {
    	  dragging = true;
      } );
      
      $body.on('touchstart', function() {
    	  dragging = false;
      } );
    
      //
      // Calculate the offset height for various elements and remove it from
      // the element's top offset so that fixed elements don't cover it up.
      //
    
      function animateOffset( element, ms, easing ) {
        $('html, body').animate({
          scrollTop: $(element).offset().top - adminbarHeight - navbarFixedTopHeight + 1
        }, ms, easing);
      }
    
      //
      // Page load offset (if necessary).
      //
    
      $(window).load(function() {
        if ( locHashIndex !== -1 && $(locHash).length ) {
          animateOffset(locHash, 1, 'linear');
        }
      });
    
      //
      // Scroll trigger.
      //
    
      $('.x-nav a[href*="#"]').on('touchend click', function(e) {
        href        = $(this).attr('href');
        notComments = href.indexOf('#comments') === -1;
        if ( href !== '#' && notComments ) {
          var theId = href.split('#').pop();
          var $el   = $('#' + theId);
          if ( $el.length > 0 ) {
            e.preventDefault();
            
            if (dragging) {
    	        return;
            }
            
            animateOffset($el, 850, 'easeInOutExpo');
          }
        }
      });
    
      //
      // Initialize scrollspy.
      //
    
      if ( $body.hasClass('x-one-page-navigation-active') ) {
    
        $body.scrollspy({
          target : '.x-nav-wrap.desktop',
          offset : adminbarHeight + navbarFixedTopHeight
        });
    
        //
        // Refresh scrollspy as needed.
        //
    
        $(window).resize(function() {
          $body.scrollspy('refresh');
        });
    
        var timesRun = 0;
        var interval = setInterval(function() {
          timesRun += 1;
          var newBodyHeight = $body.outerHeight();
          if ( newBodyHeight !== bodyHeight ) {
            $body.scrollspy('refresh');
          }
          if ( timesRun === 10 ) {
            clearInterval(interval);
          }
        }, 500);
    
      }
    
    });
    

    Hope that helps.

    #1259669
    brianjohnsondesign
    Participant

    Thank you for that. It appears to be working at the moment, but I will have to do some more testing to confirm!

    #1259989
    Rue Nel
    Moderator

    You’re welcome! We’re glad to know that it has worked for you now.
    If you need anything else we can help you with, don’t hesitate to open another thread.

  • <script> jQuery(function($){ $("#no-reply-1239894 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>