New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accordion pushing title up instead of opening content down #2578
Comments
hey @carloposo that's weird, and it's not default behavior. check out on your mobile deivce. the content isn't pushed up. http://foundation.zurb.com/docs/components/section.html#panel1. pls check your markup and css. look at the inspector. maybe there is an unclosed tag somewhere or you might have a negative margin on some element. if you're still experiencing this issue after looking into, feel free to open up this issue again. i'll close it for now. thanks! |
I was having some trouble with the scrolling behaviour of the accordeon sections a while ago too. I tried to explain the issue on the zurb foundation google group (https://groups.google.com/forum/#!topic/foundation-framework-/gS0TUjiEaxY). |
@alokzurb uhm, I have the same issue on http://foundation.zurb.com/docs/components/section.html#panel1 $(document) |
@driesderoeck ah i see what's going on. I looked at your markup for sections and I found that you were missing a couple of things. YOUR CODE: DOCS: Set "deep_linking: true;". Remove the callback function. YOUR CODE: DOCS: You are missing the equal sign on: a href="#1". I would give the sections an identifiable name also, instead of just calling it 1. You are also not setting any of the sections to "active" which means there is not default section that opens on document load. Finally you are missing data-slug="panel1" in the content div. Make sure the data-slug name is the same as the anchor tag. @carloposo try enabling deep_linking and follow the steps I mentioned here to fix your problem. Once deep_linking is enabled the anchor tags will push the browser window down to where the anchor tag is set. Let me know if this helps. I'll close this issue, but feel free to open it if this doesn't solve your problem. Thanks! |
@alokzurb I am really sorry, but that doesn't fix it for me. could be because my page is much more complex and it's using many plugins and stuff that might interfere with Section. So I'll wait for @driesderoeck's answer. What does the "one_up" variable do? |
@carloposo sorry to hear that it didn't fix your specific problem. feel free to share a link to your prototype and supporting code. @driesderoeck let me know if the solution i mentioned fixes your problem. thanks! |
@alokzurb ok, thanks for checking it out - it is working now, but I still needed to put in additional id="" arguments for it to scroll to the actual section. I can't seem to get it to work using only the data slugs and "deep_linking: true". It might be because I'm forcing it to be an accordeon using
Just two versions to compare the behaviour: @carloposo I'll have to look into the callback stuff again, last time I tried I couldn't get it to work - but that was before your reply to that post so it seems. Thanks for pointing that out, I'll give that another try. |
Hey @driesderoeck you forgot to add the data-slug. The slug name should be the same as the anchor link without the # mark. See below: div class="content" data-slug="panel1" data-section-content |
FYI. You've added it to the second section but not the first. |
Thanks for pointing out the error, but after changing it - the scrolling behaviour is still not as intended. The page seems to scroll up to the top, instead of to the beginning of the section (as it is the case in the version using id's). I tried changing the section-container to auto
but getting similar behaviour for now |
Interesting. I'll suggest this to the developers. For now try using @carloposo custom script. $(document) |
Thanks for the report! I'm going to close this issue in favor of #2938 which has a great visual demonstrating the problem and expected behavior. Hopefully we'll get this resolved shortly! |
Hi,
I've implemented Section with Tabs. It automatically switch to Accordion on mobile, which is super awesome.
What I noticed when testing my website on mobile (but maybe it's just me) is that when I click on a title to open the corresponding content, the title is pushed up, forcing to scroll up at the top of the content to start reading.
Is it just me, or is this the desired behavior?
Carlo
The text was updated successfully, but these errors were encountered: