WordPress.org

Ready to get started?Download WordPress

Forums

Collapse-O-Matic
[resolved] Element doesn't expand when id tag used in link (13 posts)

  1. adam12b
    Member
    Posted 1 year ago #

    I can't imagine what I could be doing wrong, since it's so simple to use, but linking to an element via an anchor matching its id tag is not working for me. I do get to the right location on the page, with the linked element shown right at the top of the browser, but the element is not expanded -- it's still collapsed. Any ideas?

    I'm doing it just like in the #kraftwerk example in the docs. For instance:

    [expand title="Can I receive daily digests instead of every message?" id="digest"]Yes -- see the <a href="/support/npogroups/subscribers#digest">NPOGroups Users Guide</a>[/expand]

    and then the link points to "http://coop.electricembers.net/support/faq/#digest" or faq#digest (no slash after faq), either one. WordPress and Collapse-O-Matic are totally up to date. (This site is in development, having weird problems with line-breaking too that I may have to return here for help with...).

    Thanks!

    http://wordpress.org/extend/plugins/jquery-collapse-o-matic/

  2. UaMV
    Member
    Posted 1 year ago #

    This worked for me ... unless it's a browser issue.

  3. dhkendall
    Member
    Posted 1 year ago #

    I am having a very similar problem, the ID tag works, but only if it's not on the same page as where the tag is going to.

    An example, on my site http://www.nationalanthems.info/wordpress, there is a footer on every single page talking about the Creative Commons license the site is under, the link at the very end under FAQ ("See our FAQ for details") links to the FAQ which has a whole bunch of collapse-o-matic questions and answers, on every page but one when you click on that link, it takes you to the FAQ and the pertinent collapse-o-matic opens up, like it should. However, if you click that FAQ link in the footnote when you're on the FAQ page, it just takes you to the relevant FAQ question, but it doesn't expand it.

    So the problem is that if the ID tag is referencing something on the same page, but it should work because in the documentation, it's referencing something on the same page ...

  4. adam12b
    Member
    Posted 1 year ago #

    Wow, thanks UaMV for the reality check. It's not a browser issue, same thing in Firefox & IE, but the suggestion led me to try a cache-override reload, and boom, it works. I don't understand it, but it seems I don't need to worry about it, as new visitors won't have any caching issue. Stupid of me not to try that to begin with -- always clear the cache!

  5. UaMV
    Member
    Posted 1 year ago #

    Nice ... gotta love the simple fixes!

  6. dhkendall
    Member
    Posted 1 year ago #

    Hmmm, strange, I cleared my cache, and I'm still not having it expand for me.

    If one of you went to http://www.nationalanthems.info/wordpress/faq.html , and clicked on the "FAQ" at the very bottom ("See our <u>FAQ</u> for details"), does the relevant section expand? Because it does on every other page in http://www.nationalanthems.info/wordpress, but not when you're on the FAQ!

    (I've tried this on Safari, Chrome, and Firefox, and I cleared the cache each time before I started.)

  7. Baden
    Member
    Plugin Author

    Posted 1 year ago #

    We'll look into recreating this issue on our test server and get back to you with our findings. We appreciate you not loosing hope. Rest assured, we will get this sussed out for you.

  8. adam12b
    Member
    Posted 1 year ago #

    Ah! I didn't quite understand the cache-clearing solution, and now I see that what's really happening for me is *exactly* the same as for dhkendall. If I open an id anchor while already on the page that contains it, it does not open (unless I do a cache-clear reload). If I open an anchor from a different page, it opens. So that's what it is.

    In other words, if you load http://coop.electricembers.net/support/faq and then load http://coop.electricembers.net/support/faq/#digest, it will not open. It worked before because you went straight to the latter.

  9. adam12b
    Member
    Posted 1 year ago #

    Howdy again. Sorry to bug, but no luck on this yet? We wait with bated breath.

    Thanks for all you do.

    adam

  10. Baden
    Member
    Plugin Author

    Posted 1 year ago #

    try adding class="expandanchor" to your links:

    [expand title="question 1" id="q1"]answer 1[/expand]
    [expand title="question 2" id="q2"]answer 2 also deals with <a class="expandanchor" href="#q1">question 1</a>[/expand]
    [expand title="question 3" id="q3"]answer 3 lso deals with <a class="expandanchor" href="http://spacedonkey.de/716/collapse-o-matic-id-tag-in-link/#q1">question 1</a>[/expand]

    Demo: http://spacedonkey.de/716/collapse-o-matic-id-tag-in-link

  11. dhkendall
    Member
    Posted 1 year ago #

    Thanks, works for me now!

    With one small caveat, though, it only works if you're referencing a collapseomatic on the same page (otherwise, just use it normally). This presented a bit of a problem for my footer text, as it's the same on every page. So, as I mentioned before, the "FAQ" link on the footer when clicked on every page (but one), would go to the FAQ and display the collapsed text. However, as mentioned, when I'd click the footer link when I was already on the FAQ page, it would do nothing. Now, when I added that class to the footer link, the opposite was true, on the FAQ page, clicking it would take me to, and expand, the collapseomatic, but on any other page it woiudln't even go to the FAQ.

    I worked around that by making a separate widget just for the FAQ page that replaced the default footer (which doesn't have the "expandanchor" class) with a special one for the FAQ (which does have the "expandanchor" class), and all is good.

    So, problem solved for me (and I hope adam12b as well), and I hope the workaround helps others as well.

  12. elembee
    Member
    Posted 1 year ago #

    It worked for me as well, but now it doesn't jump to that section, so it looks like nothing happens when you click because the section with the links doesn't fit in the window with the FAQ section. You can see the page here: http://elembee.com/work-with-me/. I only set the experience and design process links to have the expandanchor class — the links in the packages don't have the expandanchor class and jump to that section but don't expand. Any thoughts?

  13. dhkendall
    Member
    Posted 1 year ago #


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic