Scroll to Page/Post selected in the Menu (autoscroll?)

  • Author
    Posts
  • #60223
    kvalentk
    Power User

    With such a large image on the site, when the user clicks to go to a page or post, they cannot tell that the selected page or post displays without scrolling to it. How can I get such an “autoscroll” to work in Kahuna? I don’t want to have to make the main image less deep just for this purpose. Thanks.

    Website: settingForth.pub

    #60236
    kvalentk
    Power User

    I found a plugin that seems to be working, but it is slow so far–or perhaps I should say I’ve not found a way to speed it up yet. The plugin is “Page scroll to id.” It requires that every menu item be set as a custom link. If anyone on this forum knows how to speed it up, please let me know, and thanks.

    Website: settingForth.pub

    • This reply was modified 6 years ago by kvalentk.
    #60238
    kvalentk
    Power User

    Second update to this: The plugin was too complex for me to understand and for my needs seemed slow, though other users were praising it highly. However, through experimenting, I discovered that “/#primary” (without the quotation marks) appended to a page/post permalink works, triggering scrolling down to the page/post. So everything specified in the menu as a custom link ending in /#primary works, presumably because there is some coding associated with menus that preserves # as # instead of replacing it with %23. But when a post on a category page is accessed by clicking a Read More link on the excerpt, the # in the link is changed to %23. I can’t find a way to get around this. Nothing in Settings > Permalinks helps (# gets stripped out); I can’t find a plug-in that will do it. So, does somebody know enough to tell a newbie what to put in a function that would work to preserve # as #?

    #60320
    Zed
    Cryout Creations mastermind

    The theme already supports in-page links (since this is something the browser and HTML standards specify and not theme-dependent). You need to use content links in your menu items (and a custom menu, as you found out) for these to work, like #my-custom-link to point to an anchor defined in the content:

    [...]
    <a id="my-custom-link">&nbsp;</a>
    [...]

    or any other tag with an unique id associated to it:

    [...]
    <h3 id="my-custom-link">Section Title</h3>
    [...]

    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
    #60327
    kvalentk
    Power User

    Thank you for replying, Keymaster. The problem that remained after I solved initial stuff by adding /#primary was with category pages, where you don’t set the Read More link manually. So every time the user selects one of these (for example at http://settingForth.pub > Help Me Write > Self-Help > category page display) the page reloads, goes to the top, and all that displays is the image.

    I have found a workaround that I’m implementing now. It’s a plugin called Collapse-o-Matic that initially loads the entirety of each page/post, but with a specified portion hiddne. The user then clicks to display the hidden portion, and no reload takes place. This may cause a category page to load less quickly, so I’ll need to specify that fewer posts load, but that’s easy.

    If there is a solution to this problem that I can make work on a category page, this will save me the trouble of having to open almost 100 posts and manually specify the portion of each that is to be hidden.

    I would think that the solution to this should be included in an upgrade to Kahuna; it does seem an obvious need.

    Thanks.

    #61781
    kvalentk
    Power User

    Problem solved. In a child theme, in includes > loop.php, line 35, add /#primary, like this:

    Website: settingForth.pub

    #62145
    Zed
    Cryout Creations mastermind

    As I have answered through our support system, I strongly recommend using a child theme for this customization, otherwise it will be lost with the next update.


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Scroll to Page/Post selected in the Menu (autoscroll?)’ is closed to new replies.