malihu / page-scroll-to-id

Animated page scrolling to specific id within the document with jquery.
MIT License
224 stars 98 forks source link

ps2id_wrap not working #19

Closed tcf909 closed 5 years ago

tcf909 commented 5 years ago

Hello,

It seems that ps2id_wrap is not working. I have a multi-level menu. I'm trying to keep "Guides" (the parent category) highlighted while they scroll through the guides, but it does not appear to work.

I also notice that the offset is not taken in to account when scrolling to a ps2id_wrap id.

To access the page I'm referring to first click this link:

https://www.digitalspaces.app/?ucp-access=94e6e732

Then you can visit:

https://www.digitalspaces.app/documentation/

tcf909 commented 5 years ago

I believe it is something to do with the slash being used in the shortcode.

Any way we could get an alternative shortcode like [ps2id_wrap_end]?

malihu commented 5 years ago

Hi,

Do you use a page builder? If yes, which one?

Also, can you point me to which section you have added the ps2id_wrap shortcode?

malihu commented 5 years ago

I think you're using wpbakery page builder, correct? This page builder might not allow a single enclosed content shortcode between multiple blocks.

Instead of using the target shortcode, it's better to create the target ids as described in the tutorial here: http://manos.malihu.gr/using-page-scroll-to-id-with-wpbakery-page-builder/

You can easily add the id on the wrapper block of each section.

Let me know

tcf909 commented 5 years ago

Yes, I am using wpbakery.

I went ahead and used the alternative method. Seems to work for the most part. The only thing I can't quite figure out is how I can have 2+ nested.

<guides>
  <guide1>
    <guide1_details>
    </guide1_details>
  </guide1>
</guides>

wpbakery won't let me nest more than one layer of rows, so guide 1 won't stay highlighted.

tcf909 commented 5 years ago

I guess I could just manually add divs with ids, correct?

tcf909 commented 5 years ago

Thank you. I really appreciate the help.

tcf909 commented 5 years ago

I'm going to re-open this. I tried manually putting in divs, using the wpbakery element ids, and it is painstaking.

For one, I'm not able to do nesting more than 2 with rows (can not have more than 1 inner row). Then for some reason a text area will not get an id if you fill in the element id from wpbakery so the only way to add the divs is to include them in the raw html of the text area (which gets easily lost).

Hoping we might come up with a creative solution to make this easier for a large menu.

malihu commented 5 years ago

I'm not sure how you do this but you can add multiple elements inside a single row. You can then add the id you want in the Row ID which is the same as using the ps2id_wrap shortcode.

For example:

Add a row with id general. Inside that row, add the elements you want, e.g. "Phased Rollout", "Autonomous Objects & Blueprints", "Elastic Runtime" and "Code Market". Give each element the id you want.

Having more than 2 level of rows is not allowed by WordPress so perhaps you could add the 3rd level wrapper as HTML? Something like:

-row (with id)
--element  (with id)
--element  (with id)

-row (with id)
--row (with id)
---element  (with id)
---element  (with id)
--row (with id)
---element  (with id)

-row (with id)
--row (with id)
---HTML (with id)
----element  (with id)
tcf909 commented 5 years ago

I'll give it a try. The issue I ran in to is WP Bakery did not want to actually put the Element Id in the HTML for TextBoxes (Element).