Support » Plugin: Page scroll to id » Length error in minified js

  • Resolved Steve D

    (@steadwell)


    Hello,

    First of all, great plugin, just what I needed!

    I’ve been inserting the scroll to links and plugin required tags in “text” edit mode which doesn’t allow for the edit “button” as it does in “visual” mode. Show mode strips my tags, a bug (or feature) that I don’t much care for.

    By adjusting the offset on the plugin settings panel, I’ve been able to fine-tune the scroll to functionality perfectly (had to compensate for the admin bar).

    My problem is, and it’s really not a major one, is that I’m getting the following error in my console:

    Uncaught TypeError: Cannot read property 'length' of undefined
        at page-scroll-to-id.min.js?ver=1.6.2:2

    My site is here if you would like to take a look. The scroll-to-id link is in the block of text in the “About” section that scrolls to “Published Articles”.

    Any pointers would be greatly appreciated.

    Thanks in advance!

    • This topic was modified 1 year, 2 months ago by  Steve D.
    • This topic was modified 1 year, 2 months ago by  Steve D.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author malihu

    (@malihu)

    Hello,

    I checked your link and the output HTML is not correct as it has the following attribute:
    a[rel="m_PageScroll2id" ]=""

    The attribute should be:
    rel="m_PageScroll2id"

    I don’t know if your theme’s editor strips or modifies the rel attribute but can you post what you entered in text editor?
    Did you insert the links as HTML or shortcodes?

    If you need to add the link in HTML, you can either use the rel or class attributes like this:

    <a id="scroll-down" href="#published-articles" class="ps2id" title="...">link text</a>
    <a id="scroll-down" href="#published-articles" rel="m_PageScroll2id" title="...">link text</a>

    Let me know

    Thanks for your quick response!

    I coded the link and target in html via “text” edit mode, after using shortcodes at one point. The reason being that I wanted to include the svg in the “a” tag. As you pointed out, the “rel” parameter is anomalous – I either forgot to take it out or inadvertently rolled back to a previous version, nevertheless, I removed it completely since I’d already specified the required classes. Even after removing the rel parameter and clearing cache, I get the same length error.

    Here is the link (after removing rel):

    <a id="scroll-down" class="ps2id mPS2id-clicked" href="#published-articles" title="Scroll down to Published Articles">civilian journalist <svg class="icon icon-arrow-right rotate-90" aria-hidden="true" role="img"> <use href="#icon-arrow-right" xlink:href="#icon-arrow-right"></use> </svg></a>

    … and here is the target:

    <div id="published-articles" class="mPS2id-target"></div>

    Like I’d mentioned previously, it does work, I’d just like to figure out exactly what the error is.

    Thanks for your time!

    • This reply was modified 1 year, 2 months ago by  Steve D.
    • This reply was modified 1 year, 2 months ago by  Steve D.
    Plugin Author malihu

    (@malihu)

    Remove the mPS2id-target class from the div. These classes are added by the plugin automatically.

    Okay,

    After removing the mPS2id-target class from the target div, the error persisted, making me think it was something in the plugin settings. After unchecking the “Prevent other scripts from handling plugin’s links (if possible)” option in Advanced Settings, which I had checked while trying to resolve this, did the problem go away.

    It’s all good – marked as “resolved”.

    Thanks Malihu!

    • This reply was modified 1 year, 2 months ago by  Steve D.
    Plugin Author malihu

    (@malihu)

    Thanks for the feedback. I inspected your link’s attached events and it seems that you don’t need this option enabled 😉

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Length error in minified js’ is closed to new replies.