Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Linking to an anchor tag on different post/page prevents scrolling up #887

Closed
ehrhino opened this issue Sep 8, 2016 · 7 comments
Closed

Comments

@ehrhino
Copy link

ehrhino commented Sep 8, 2016

Can't find anything about this online or the general Foundation docs, so wondering if anyone here has run into this/has ideas on how this can be fixed.

How can this bug be reproduced?

  1. Go to [http://x.red-rhino.com/csi/support-wellness/food-support/#food-bank]
  2. Try and scroll up.

This happens anywhere there is a link going to an anchor tag on another page or post. The above is just an example.

What did you expect to happen?
You should be able to scroll up to see the above content, etc as a normal page would function. I'm guessing that this has something to do with how foundationpress sizes the page to fit the window. No idea, though. Issue does not occur when linking to an anchor tag on the same page.

I am using a js snippet to smooth scroll to anchor tags, but I've commented that out and the issue still persists. I'll include it though in case.

$('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 500); return false; } } });

Thanks for any help you all can offer!

Please List the Following:

  • OS & version: Latest Chrome, Safari, and Firefox
  • Node version (node -v) [Node v4+ is required] : v4.4.4
  • Foundation version (bower list) : 6.2.2
@colin-marshall
Copy link
Collaborator

colin-marshall commented Sep 8, 2016

@ehrhino try removing the "sticky" behavior from the menu and see if that changes anything.

@ehrhino
Copy link
Author

ehrhino commented Sep 8, 2016

@colin-marshall Just tried that, but to no avail. Here's what it is:
$(window).scroll(function() { if ($(this).scrollTop() > 1){ $('#site-navigation').addClass("sticky"); $('.pre-nav').slideUp(400); } else{ $('#site-navigation').removeClass("sticky"); $('.pre-nav').slideDown(400); } });

I also tried commenting out the stickyfooter.js , but that didn't work either :/

@colin-marshall
Copy link
Collaborator

@ehrhino try removing all custom JS and also remove all the html markup that has to do with sticky.

@ehrhino
Copy link
Author

ehrhino commented Sep 8, 2016

@colin-marshall
I removed all custom JS, and the nav bar completely, but still nothing. However, when I commented out:

<?php if ( get_theme_mod( 'wpt_mobile_menu_layout' ) == 'offcanvas' ) : ?>
    <div class="off-canvas-wrapper">
        <div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
            <?php get_template_part( 'template-parts/mobile-off-canvas' ); ?>
<?php endif; ?>

and it's closing tags in footer.php then the issue was solved...leading me to believe it's something with the off-canvas js (which I use for the mobile menu).

@colin-marshall
Copy link
Collaborator

Good find! I will see if there are any similar bug reports in Foundation.

@ehrhino
Copy link
Author

ehrhino commented Sep 21, 2016

@colin-marshall any luck? Did some poking around myself, but couldn't find anything.

@olefredrik
Copy link
Owner

I'm unable to reproduce this error. Is this still an issue? If yes, can you please try to reproduce with the latest version of FoundationPress (it has been updated to use Foundation 6.4.1). If no, can you please close the issue? :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants