This website uses cookies to personalise ads and to analyse traffic ok
web design

Page scroll to id for WordPress

Page scroll to id is a fully featured WordPress plugin for creating links that scroll the page smoothly to any id within the document. The plugin replaces browser’s “jumping” behavior with a smooth scrolling animation, when links with href value containing # are clicked.
It provides all the basic tools and advanced functionality for single-page websites, in-page navigation, back-to-top links etc. with features like: adjustable scrolling animation duration and easing, link and target highlighting via ready-to-use CSS classes, vertical and/or horizontal scrolling, scrolling from/to different pages etc.

Get started

The plugin works by “connecting” links with href/URL in the form of #my-id or to sections/elements within the document with an equivalent id attribute value (e.g. <div id="my-id">...</div>). Clicking such links will scroll the page smoothly to their target id position.

Get started by creating or setting-up your links. The plugin is enabled by default on WordPress Menu links (created in Appearance → Menus), so you can start adding custom links and set their URL to the id/target you want to scroll to (e.g. #my-id, /page/#my-id, etc.).
You can use id values that already exist in your theme or you can create your own id targets using plugin’s “Insert Page scroll to id target” button in wp post visual editor or the [ps2id] shortcode (e.g. [ps2id id='my-id'/]).

To create links within your content, use plugin’s “Insert/edit Page scroll to id link” button and/or shortcode (e.g. [ps2id url='#my-id']link text[/ps2id]) in wp post visual/text editor.
To enable the plugin on existing links, add the ps2id class or the m_PageScroll2id rel attribute to them, making sure the link’s href/URL value contains a hash (#) with the id of the section you want to scroll-to. In addition, you can simply add your links CSS selector (e.g. .menu-item a, a[href*=#]:not([href=#]) etc.) in “Selector(s)” field in plugin settings.

To highlight your links (or targets), use the classes provided by the plugin in your theme’s stylesheet or custom CSS. The default highlight class is mPS2id-highlight but you can set your own in the “Classes & highlight options”. For example, to style the highlighted link (the link whose target element is considered to be within the viewport), you could add in your CSS:
a.mPS2id-highlight{ background: #ff0; } or .menu-item a.mPS2id-highlight{ background: #ff0; } for highlighting custom menus links only.

If you have a fixed-positioned/sticky menu which overlaps your target’s content when page scrolling is completed, insert your menu CSS selector or a fixed pixel value in the “Offset” field. For example, inserting #navigation-menu will offset the scroll-to position according to the height/width/position of the element with id navigation-menu. In the same manner, setting the “Offset” value to 100 will offset page scrolling by 100 pixels.

Plugin settings


Use the Selector(s) field when you need to instruct the plugin to handle specific links. The value(s) should be anchor tags (a, i.e. links) in the form of strings that represent ways of choosing elements in the DOM (i.e. CSS selectors).
Each selector is separated by comma, so multiple selectors can be defined as: selector1, selector2, selector3 etc.

The default selector value is a[rel='m_PageScroll2id'], meaning the plugin handles by default all anchor elements (a) with m_PageScroll2id rel attribute value.
Other selector examples could be: a[href*='#'] (links that contain # in their href/URL attribute), a[href='#my-id'] (links with href attribute value: #my-id), a.className (links with class: className).

To enable the plugin on any link that has a hash (#) in its URL, insert a[href*=#]:not([href=#]) as a single selector.

Other default selectors which the plugin is applied automatically include the class ps2id (actual selectors: .ps2id > a[href*='#'] and a.ps2id[href*='#']). This means that any link with a hash in its URL/href (e.g. #my-id) which has the class or is contained (direct children) within an element with the class ps2id will be handled by the plugin automatically.

The option “Enable on WordPress Menu links” (enabled by default) enables the plugin automatically on custom links created in WordPress Menus.

Scroll duration

Scroll animation duration (i.e. scrolling speed) in milliseconds (1000 milliseconds equal 1 second). Lower values equal faster scrolling.

“Auto-adjust scrolling duration” option (enabled by default) lets the plugin fine-tune scrolling duration/speed according to target and page scroll position. This normalizes the animation duration in order to avoid short-distance scrolling taking too long (e.g. a page scroll of just 100 pixels will last shorter than the value specified in “Scroll duration”).

Scroll type/easing

Scroll animation easing type (i.e. the way the animation progresses at different points within its duration).
You can set different easing types according to page scrolling state: one that is applied when the page is idle (no scrolling currently running) and another that applies while page is scrolling (when a link is clicked while the page is animated/scrolling).

Scroll duration and easing demo

Scroll behavior

Always scroll smoothly when reaching the end of the page/document option adjusts scroll-to position so it does not exceed document length. For example, when scrolling to a target element that is at the bottom of the page, the scrolling animation stops smoothly at bottom of the page instead of “breaking” at an earlier point.
Enable Stop page scrolling on mouse-wheel or touch-swipe option if you want to stop page scrolling when the user tries to scroll the page manually (e.g. via mouse-wheel or touch-swipe).

Page layout

Set page scrolling direction (i.e. restrict scrolling) to top-bottom (vertical) or left-right (horizontal) accordingly. For both vertical and horizontal scrolling select auto.
This option does not transform your theme’s templates layout (i.e. it won’t change your theme/page design from vertical to horizontal).


Offset scroll-to position by x amount of pixels or by selector. The offset value can a be a positive or negative number (indicating pixels), or a matching set of elements in your html (selector). For example, setting the value to 50 will stop page scrolling 50 pixels before reaching the target.
If you need to offset scrolling according to the height (or width) of some element (e.g. according to a responsive/sticky navigation menu), insert the element’s selector in the Offset field. For example, if you have a top fixed/sticky menu with id navigation-menu, set the offset value to #navigation-menu in order to stop page scrolling below it and avoid the menu overlapping your content.

To set different vertical and horizontal offsets (e.g. when Layout is set to auto), add comma separated values in Offset field, e.g. 100,50 (vertical offset 100 pixels, horizontal offset 50 pixels).

The plugin offers selector expressions in order to define more advanced offset values. Examples:

  • :fixed expression – Offset by element with id “some-id” and CSS position fixed: #some-id:fixed
    Assuming vertical layout, the value above will offset scrolling according to the height of #some-id element (i.e. the element that has id some-id), but only when this element CSS position is fixed (i.e. element is sticky). This is useful when for example you have a navigation menu that is sticky/fixed only above a specific viewport size (e.g. only on desktop).
  • :height() expression – Offset by element with class “some-class” and height equal to 100 pixels: .some-class:height(100)
    The value above will offset scrolling according to the height (on vertical layout) of .some-class element (i.e. the element that has class some-class), but only when this element height is exactly 100 pixels.
  • :width() expression – Offset by element with id “some-id” and width greater than 800 pixels: #some-id:width(>800)
    The value above will offset scrolling according to the height of #some-id element, but only when this element width is greater than 800 pixels. This is useful when having responsive navigation menus. For instance, you might have a responsive top sticky menu that switches to a “hamburger” menu when viewport is 800 pixels wide or less. Assuming the menu is as wide as the page/viewport, you’d only want to apply its height as offset when its width is greater than 800 pixels (i.e. when it’s not “hamburger” menu). Adding: #your-menu-id:width(>800) as the offset value will do exactly that.
  • Multiple expressions – Offset by element with id “some-id”, CSS position fixed and height between 50 and 100 pixels: #some-id:fixed:height(>50):height(<100)
    The value above will offset scrolling according to the height of #some-id element, but only when this element CSS position is fixed and its height is anywhere between 51 and 99 pixels.

Highlight selector(s)

The matching set of elements (i.e. selectors) handled by the plugin, that will be eligible for highlighting. The value(s) should be anchor tags (a, i.e. links).

The plugin highlights by default all the links it handles. Using this field, you can specify which links should be highlighted and exclude the rest.
For example, assuming you have various links that scroll the page (e.g. menu links, back-to-top etc.) and you want only the menu links to get highlighted, you could insert:
.menu-item a[href*='#']

Classes & highlight options

The plugin adds special classes to the links and the target elements it handles when the following happen:

  • When a link is clicked, it gets the mPS2id-clicked class.
    You can change this class name to your own and you can use it in your CSS to style the clicked link. For instance:
    .mPS2id-clicked{ background: #ff0; }
  • When a link’s target element is within the viewport (i.e. visible on the screen), the link gets the mPS2id-highlight class and the target element gets the mPS2id-target class.
    You can change these class names to your own and you can use them in your CSS to style the highlighted link and target. For instance:
    .mPS2id-target{ background: #ff0; }
    a.mPS2id-highlight{ background: #ff0; }

In addition, the plugin will add the above highlight classes with the -first and -last suffix (e.g. mPS2id-highlight-first, mPS2id-highlight-last) in order to differentiate multiple highlighted elements. This is useful when you need to style only the first or last of the highlighted links or targets in your CSS.
For example, if multiple links are highlighted at the same time, instead of using .mPS2id-highlight in your stylesheet, you could do:
a.mPS2id-highlight-first{ background: #ff0; }

An alternative way of restricting highlight to a single link/target and prevent multiple elements from being highlighted at the same time, is to enable Allow only one highlighted element at a time.

There are times when you need to keep at least one element (e.g. a menu link) always highlighted. Enable Keep the current element highlighted until the next one comes into view option if you need such functionality/behavior and your template/page is laid out in a way that at certain scrolling points there are no target sections visible on the screen (no links highlighted).

Enable Highlight by next target option when your target elements have zero height/width to improve highlighting behavior. This option is useful when you add id targets in your content via plugin’s buttons or the [ps2id id='some-id'/] shortcode, as it extends the scrolling range at which an element stays highlighted.

Disable plugin below

Set the viewport/screen-size in pixels, below which the plugin will be disabled. The value can be width or width,height.
For example, insert 1024 to disable plugin’s functionality when the viewport/window width is 1024 pixels or less. Insert 1024,600 to disable plugin when viewport width is 1024 pixels or less and viewport height is 600 pixels or less.
Please note that the values entered will match CSS media queries.

Leaving the field value empty or 0 (default) disables the option.


Check Display widgets id attribute in order to show the id attribute of each widget in Appearance → Widgets. This is a convenient way of finding existing id values in order to use them as links targets.
You can also create your own id targets in widgets via the “Page scroll to id target” widget.

Enable insert link/target buttons in post visual editor activates plugin’s buttons in WordPress visual editor toolbar. You can use these buttons to insert links and id targets in your content.

Advanced options

If another plugin or a theme script handles page scrolling and conflicts with “Page scroll to id”, try enabling Prevent other scripts from handling plugin’s links option. This option attempts to remove (on-the-fly) javascript click events by other scripts from the links. Please note that this might not work on some themes or plugins, as it depends on the way those scripts are attaching the link events.

Enable Normalize anchor-point targets to normalize/reset the CSS properties (height, line-height, border etc.) of anchor-point targets.

wp-config options

define('PS2ID_MINIFIED_JS', false);
Use the PS2ID_MINIFIED_JS constant (permanent global variable) in wp-config.php to select which script files will be loaded on the front-end by the plugin. Adding the above in wp-config.php instructs the plugin to load the non-minified/development version of its scripts.

Divi WordPress Theme Monarch Social Sharing Plugin

Plugin shortcodes

Plugin’s [ps2id] shortcode can be inserted directly in WordPress post editor (as with any WordPress shortcode) in order to create links and id targets in your content.

[ps2id url='#some-id']link text[/ps2id]


  • url (required) – Link URL
    [ps2id url='#some-id']link text[/ps2id]
    [ps2id url='']link text[/ps2id]
    [ps2id url='/page/#some-id']link text[/ps2id]
  • offset (optional) – Link-specific offset (bypasses the general offset value in plugin settings)
    Offset scrolling by 100 pixels
    [ps2id url='#some-id' offset='100']link text[/ps2id]
    Offset scrolling by the height (or width for horizontal layout) of the element with id navigation-menu
    [ps2id url='#some-id' offset='#navigation-menu']link text[/ps2id]
    Offset vertical scrolling by 100 pixels and horizontal scrolling by 50 pixels
    [ps2id url='#some-id' offset='{"y":"100","x":"50"}']link text[/ps2id]
  • class (optional) – Link custom class(es)
    You can give the link one or more custom classes (separate multiple classes with space).
    [ps2id url='#some-id' class='class-a']link text[/ps2id]
    [ps2id url='#some-id' class='class-a class-b']link text[/ps2id]

    You can change the scroll duration/speed of the link (bypass the general scroll duration value in plugin settings) by adding a special class in the form of ps2id-speed-VALUE (i.e. ps2id-speed-600) with VALUE indicating the scroll duration in milliseconds (lower duration equals faster scrolling).

    [ps2id url='#some-id' class='ps2id-speed-400']link text[/ps2id]
    [ps2id url='#some-id' class='ps2id-speed-1300 class-a class-b']link text[/ps2id]

Target id shortcode

There are 2 target shortcodes:

1. Anchor-point target

[ps2id id='some-id'/]

2. Wrapper target

[ps2id_wrap id='some-id']
your content...

You can use the wrapper target ([ps2id_wrap]) when you need to wrap content in a target id (same as adding an id attribute to some content). Doing this gives you better control over the highlighting of associated links.
In addition, wrapper target allows you to include other shortcodes within its content, e.g.

[ps2id_wrap id='some-id']
content... [ps2id url='#another-id']link text[/ps2id] 
more content...
[ps2id id='another-id'/]


  • id (required) – Target id
    [ps2id id='some-id'/]
    [ps2id_wrap id='some-id'] your content... [/ps2id_wrap]
  • target (optional) – The element that’ll be considered as the actual target for highlighting
    This can be useful when you need better highlighting for target elements that have zero dimensions.
    The associated link will scroll to #some-id element but will be highlighted as if its target is the next adjacent div (the div immediately following #some-id element)
    [ps2id id='some-id' target='#some-id + div'/]
    The associated link will scroll to #some-id element but will be highlighted according to #another-id element
    [ps2id id='some-id' target='#another-id'/]

Previous versions

Development version:

Pages: 1 2


Post a comment

Comments pages: 1 2 3

  1. Luigi
    Posted on March 20, 2018 at 15:32 Permalink

    Hey there,
    I searched the comments as you already explained really a lot. But I could not find an answer on this:

    Is it possible to define different offsets per target and not per link?

    I use default offset for my nav-bar which works fine for all links/elements except the first, because it overlaps my front image section.


    • Luigi
      Posted on March 20, 2018 at 15:35 Permalink

      I checked the Offset-Section as well:

      But could find out how to define a default and a specific target offset within the regarding option.
      Something like: 100 (default), 200 (#portofolio)

    • malihu
      Posted on March 21, 2018 at 02:03 Permalink


      There’s no offset for targets (offset applies to links). You can move/offset a target element (or any section) in your content by simply increasing its top padding via CSS.

      One approach is to give your target element a negative top margin and an equal top padding (your element should have a css position set, e.g. relative).
      For example:

      #portofolio{ margin-top: -100px; padding-top: 100px; }

      The above will affect scrolling offset but not visual design of the element/section.

      Hope this helps

      • Luigi
        Posted on March 21, 2018 at 13:12 Permalink

        Thanks for the hint! And sorry I bothered you with this.

        Of course I just could have set the target on the overlapping container which already has the negative top-margin..
        Well, that’s my fifth day with WP, so forgive my question 😉

        • malihu
          Posted on March 22, 2018 at 04:22 Permalink

          No problem 🙂

  2. Sven
    Posted on March 15, 2018 at 19:47 Permalink

    Hi malihu

    Thank You very much for Your create job with this Plugin!!!

    Could You just please show detailed example how to highlight target where the page scrolls.

    How to make target to be certain selected text in page and how to write css that highlights the targeted text if page scrolls to that text?

    Help is really sincerely appreciated


  3. Andy
    Posted on March 9, 2018 at 20:02 Permalink

    Great plugin, extremely useful and effective. However, I just ran into a problem with multiple links being highlighted if their targets appear in the same screen when scrolling. I have checked “Allow only one highlighted element at a time” but it still does not highlight only one link. Please can you help me. Thanks.

    Here is my page:

    • malihu
      Posted on March 11, 2018 at 17:55 Permalink


      Not sure if you solve the issue but when I check your page at:
      (I’m assuming this is the correct link), the links are highlighted one at a time.

      • Andy
        Posted on March 14, 2018 at 18:22 Permalink

        Yes malihu, just a heads up, I fixed it by unchecking “Enable on WordPress Menu links” in the settings page.

  4. felix roth
    Posted on March 8, 2018 at 21:54 Permalink

    Hello mahilu,

    I’m using a page builder (unyson) that automatically gives IDs to sections that I want to use as Scroll-to-targets.

    Like this: ….

    The problem is, that these IDs are not static. I.e. if you change the order of the sections within the page builder, all these section IDs change, which makes it a hassle when using them as Scroll-to-targets.

    Changing order of sections in page builder results in:

    before: id=”section_id-155550″
    after: id=”section_id-255550″

    But using 2 IDs for the same DOM element will bring me into more trouble I think:


    Wont work.

    Please help.
    Thank you.

    • malihu
      Posted on March 8, 2018 at 23:05 Permalink


      You should add extra id targets via plugin’s toolbar button or shortcode. These will remain the same no matter the order of their parent section and independent of the unyson builder’s ids.

      If you feel that you’ll change the order of your sections constantly, then you need to have a fixed target reference for your link(s). Just create the targets using the tools provided by “Page scroll to id” (button or shortcode).

      Using plugin’s function(s) to create the targets will not give your sections a second id (this is not possible anyway). It’ll create a new (hidden) element that’ll act as the target.

  5. Steve
    Posted on February 27, 2018 at 13:07 Permalink

    Hi Malihu,

    I’m having some trouble getting the plugin to work on my environment. Would you mind helping me to get it going?

    I am using WordPress twenty seventeen theme, and I am working on localhost (website is not published yet) on my PC.

    I’ve downloaded the plugin and activated it, but when I go to the website, all of the menu items are highlighted with the colour they should be only when the are selected.

    When I do select a menu item, nothing happens.

    I’ve left the default values in the settings of the plugin.

    Any suggestions would be greatly appreciated.

    • malihu
      Posted on February 27, 2018 at 13:22 Permalink


      The links highlighting you see probably comes from your theme’s stylesheet, especially if you used the full URL in your links. See “Multiple links get highlighted! How to highlight only one?” in FAQ.

      Regarding menu links doing nothing: Have you added the id target(s) in your page/content?
      See this related FAQ.

      In addition, have you followed the basic tutorial?

      Let me know

      • Steve
        Posted on February 27, 2018 at 20:03 Permalink

        Hi Malihu,

        Thanks for the information.

        Sorry, my mistake. I have used the sections I set in the Customise –> Theme Options as the reference points in the menus. I take it, based on the tutorial, the plugin only works with id targets created in a page which has different sections.

        I’ll give your suggestions a try and see how it works out.

        Thanks again for taking the time to respond to my question and sorry for troubling you with what I should have seen in the tutorial.


        • malihu
          Posted on February 27, 2018 at 20:30 Permalink

          No problem 🙂

  6. Kat
    Posted on February 26, 2018 at 10:31 Permalink

    In Appearance > Menus, how do I set a custom link to a category page, so this plug-in will work? Also, it seems to be taking quite a long time to activate once a menu item is clicked. You can see this at if you click Home, which I have set to a custom link, or Help Me Write > How Can I Help, which is also set as a custom link. Thanks.

    • malihu
      Posted on February 26, 2018 at 14:25 Permalink

      It seem to take a long time to scroll because the page is reloaded and then scrolled as opposed to just scroll to the target. This happens because your link’s URL is not correct.

      Your “Home” link URL is:
      when it should be:

      You don’t have a home directory (your homepage URL is not, so you need to remove home part from your homepage link(s).

      Also, your “How Can I Help” is:
      when it should be:

      Note the trailing slash before the hash.
      Your server is configured to always use trailing slashes, so for example when you go to:
      the server redirects to:

      This means that a link without a trailing slash will redirect (i.e. reload the page) because for the browser the 2 URLs above are completely different. So just make sure you always use trailing slashes in your links URL.

      For category pages, just visit the category page in your browser, copy the URL from the address bar, paste it as a custom link (in your menu) and add the target id you want at the end (e.g.

      • Katharine
        Posted on February 26, 2018 at 22:20 Permalink

        malihu, thank you for a thorough response. I have implemented according to your direction, and everything now works. However, it is still quite slow, apparently still the result of page reload. I may not be able to do much about speed since most of these pages actually are separate pages–unless I can figure out how to load a new target page without reloaded the home page with the image. If you, or anyone, has any suggestions, please let me know.

        • malihu
          Posted on February 27, 2018 at 01:31 Permalink

          It seems that you don’t have “Page scroll to id” activated in your site(?), so I can’t really help. Do you have the plugin?

  7. Jessica
    Posted on February 23, 2018 at 19:49 Permalink

    Hi there,

    Thank you for the great plugin!

    I switched the selector so that it worked with the “#” as the URL for the ‘Personal Stories More Details’ button on the home page, but I am wondering if there is a way to disable this from other pages? I ask because it seems to be affecting how my accordion works on the “Mythbusters” page.

    Thanks in advance!

    Bypass link:

    • malihu
      Posted on February 24, 2018 at 00:59 Permalink


      You’ll need to change the general selector to a more specific one (e.g. the selector of your “more details” link). In plugin settings change the “Selector(s)” option to:

      .vc_cta3-container a[href*=#]:not([href=#])

      and hit save changes.

      Hope this helps

      • Jessica
        Posted on February 26, 2018 at 19:25 Permalink

        It did! Thank you very much!!

      • Jessica
        Posted on March 6, 2018 at 02:02 Permalink

        Hmm I seem to be running into this issue again with other elements of the website, even though the selector is specific to that one piece.

        On our “Research” page, there are tabs that include links to the other tags and those elements use #TabName. But when I click on one of these links i.e. “what can be done about it”, it slow scrolls to the bottom of the page. When I deactivate the plugin, the links function properly and switch tabs. Any idea? Thanks in advance!

        • malihu
          Posted on March 6, 2018 at 11:13 Permalink

          Go to plugin settings and change the “Selector(s)” option to:

          a[rel='m_PageScroll2id'], a.vc_btn3

          and save changes. This should do the trick.

          In addition:
          Do you use WPBakery Visual Composer? If yes, I think you can give your elements (e.g. your button links) a class (via the “Extra class name” field). If this is the case, then you can give any element you want the plugin to use the extra class name ps2id. This way, only the elements with this class will be used by “Page scroll to id”.

          • Jessica
            Posted on March 6, 2018 at 19:02 Permalink

            Hmm unfortunately it is still doing to same thing. I changed the selector in the settings, and I added ‘ps2id’ to the extra class of the ‘More details’ button on the front page (where I want the plugin to work), but unfortunately the tab links in the ‘Research’ section still slow scroll to the bottom of the page when clicked.

        • malihu
          Posted on March 6, 2018 at 19:21 Permalink

          Your settings are correct.

          It seems that your link (in “Research” tab) “what can be done about it” is handled by “Page scroll to id”. How did you create this link?

          If you created it using “Page scroll to id” toolbar button (or shortcode) then it’s going to be handled by “Page scroll to id”.

          If you don’t want this to be handled by the plugin, then you should create a standard WordPress link instead.

          Let me know

        • malihu
          Posted on March 6, 2018 at 19:24 Permalink

          In addition:

          You should add the class ps2id on the button/link itself (you currently have it on its parent section).

          • Jessica
            Posted on March 6, 2018 at 20:57 Permalink

            You’re right! I’ve made the changes and those in-text links all work now – thank you!

            Seems like the navigation buttons at the bottom (previous section, next section) are still being handled by the plugin. Have I done something wrong again?

        • malihu
          Posted on March 7, 2018 at 12:47 Permalink

          OK I think it’s better then to use a specific selector for each link you want to be handled by “Page scroll to id”.

          In plugin settings change the “Selector(s)” option to:

          a[rel='m_PageScroll2id'], a[href='#patientstories']

          This will instruct the plugin to handle only the link with URL #patientstories and nothing else.

          In the future, when you need another link to be handled by the plugin, you can either give it the class ps2id or add its selector in “Selector(s)” option (separated with comma). For example:

          a[rel='m_PageScroll2id'], a[href='#patientstories'], a[href='#anotherLink']

          • Jessica
            Posted on March 7, 2018 at 21:42 Permalink

            That works beautifully – exactly what I needed. Thank you very much!

  8. Andrew
    Posted on February 23, 2018 at 14:32 Permalink

    Hello Malihu,

    Many thanks for a great plugin – I’m having issues getting it to effect my website and lock to each page section when using the menu.

    When the menu is used, the pages scroll to a point that’s short of where I would like it to land. I’m not sure if my website images are causing the landing point issues ?

    Below are the current default settings, I also tried to change the offset, -400, – 1000 – make no difference at all to the landing points.

    I’m a little new to setting this up and my pages are typically set for example :

    Selector currently set at : a[rel=’m_PageScroll2id’]
    Website :

    Appreciate any help

    • malihu
      Posted on February 23, 2018 at 14:44 Permalink

      Hello Andrew,

      I checked your page but I cannot find any links used by the plugin. Did you removed them? Can you post a page where you use page scrolling so I can check it and see what happens?

      • Andrew
        Posted on February 25, 2018 at 09:03 Permalink

        Hi Malihu,

        I forgot to mention in my prior reply, that I’m using the WordPress Twenty Seventeen theme. It only has 4 default sections in addition to the Front Page Section 1 Content section.

        I’m looking to make this Header Front page section (Home page) at 100% image with the Top menu bar lying at the bottom of the browser when you first visit the website.

        In the default theme this header Front page image and further image and text below on my website – the page section called IT Puzzles Can Be Solved, is where I also want to somehow make the website scroll to this section when you select IT Puzzles Can Be Solved from the menu.

        Hope this makes sense, as for some reason the default Twenty Seventeen theme somehow ties the Homepage section and this next section together, so when I select IT Puzzles Can be Solved from the menu, nothing seems to happen? looks like it wants to go back to home page?

        Your help here would be great !


        • malihu
          Posted on February 26, 2018 at 14:46 Permalink


          Your target ids (and id attributes in general) cannot have spaces. They can have letters, numbers, dashes (-) and underscores (_).

          For example, your target id should be:
          and your link’s URL should then be:

          You also have an error (typo) in plugin’s selector. You’re missing a closing ) at the end.
          Go to “Page scroll to id” settings and change the “Selector(s)” value to:


          just copy/paste the selector above exactly as it is (make sure you copy all of it!) and hit save changes.

          Hope this helps

  9. Alessandro
    Posted on February 13, 2018 at 19:23 Permalink

    Hi, first of all, good plugin thank you for this.
    So, I’ve set some anchor in my one-page web site When i go to home page and click on menu ono to one it is all right, but if a select fast the last module on menu ( on bottom page) plugin scroll till the module before then i have to click another time on the same menu voice to arrive to destination. This apperas if I go into a article ( offers) then i click on contatti (the last voice of menu), plugin return into home page and scroll till module before contatti and i have to click newly on menu to set line correctly…
    there is a solution of this?
    thank you in advance

    • Alessandro
      Posted on February 13, 2018 at 19:25 Permalink

      sorry domain is this

    • malihu
      Posted on February 14, 2018 at 01:38 Permalink


      First, you have a page error that prevents most scripts from working. The error I get in developer tools console is:

      Uncaught SyntaxError: Unexpected token <

      which comes from this line of code in your index file:

      /* */</script> <script type='text/javascript'><script type="text/javascript"> some js code here... </script> </script>

      This said, the issue you describe comes from the fact that you have some images in your page that are loaded after the page is scrolled to their position. This type of functionality is called lazy-loading and it always conflicts with in-page anchors and scrolling navigation.

      The problem is that these images (that are lazy-loaded) don’t have a fixed height set, so when they load, they increase the overall height of the document, thus changing the position of your targets that sit at the bottom of the page. This happens while the page is scrolling.

      This is a little technical so to give you an example, it’s like driving a car to a town 50km away but by the time you drive 50km, another 20km of road was just built. So now, you need to drive another 20km to reach your actual destination (i.e. the town). That’s why you need to click 2 times to reach the correct position (i.e. the id target).

      I hope all this makes sense.

      Note that lazy-loading images will have this same problem even if you don’t use “Page scroll to id” plugin.

      The only solution for this is either set a fixed width/height for your lazy-loading images placeholder or remove the lazy-loading images functionality.

      • Alessandro
        Posted on February 14, 2018 at 18:04 Permalink

        Thank you for your assistance, you are very professional.
        I cut-off lazy load from imageand all work fine on home page though from internal page ( offerte) to home page problem remains. So I have set delay for scrolling to 3000 millisecond to give at page time to load correctly and then all works fine.
        Thank you for all,
        very god plugin.


        • malihu
          Posted on February 14, 2018 at 23:56 Permalink

          Thanks, you’re welcome 🙂

          You can probably try to lower the delay if you want. I’d start at about 300 milliseconds and increase it if needed.

          Glad I helped.

  10. Paul
    Posted on February 4, 2018 at 09:01 Permalink

    I cant See Post ToolBar Button in Visual Editor Please tell me how to Fix?

    • malihu
      Posted on February 4, 2018 at 11:15 Permalink

      If you’re using page builder (like Divi builder) you won’t see plugin’s toolbar buttons because these builders do not allow third party buttons in the editor.

      In such case, just use plugin’s shortcodes directly in the editor. The toolbar buttons and shortcodes do exactly the same thing.

  11. Paul
    Posted on February 4, 2018 at 08:58 Permalink

    Am Not Getting Post Scroll to id button on Post Tabs. How to solve?

  12. Marco
    Posted on January 30, 2018 at 20:12 Permalink

    Hi, how I can use the Plugin on a Button/Image and
    after click this Button/Images scroll down to an
    anchor on the same page, please!???
    Thank you very much…

    • malihu
      Posted on January 31, 2018 at 08:51 Permalink

      The quickest way is to go to plugin settings and change the “Selector(s)” option value to:


      Save changes.

      Then go to your page/post editor and create your normal image button and make it a link that points to your target (e.g. give it a URL #your-target-id).

      Another way would be to use plugin’s toolbar button or shortcode to create your link (see tutorial).

      After you create the link, you could style it (e.g. add a background image, color, size etc.) in your CSS (e.g. via WordPress additional CSS).

      • Marco
        Posted on January 31, 2018 at 18:07 Permalink

        Thank you! That was help me.

        I solved it via your Selector(s) Code and:
        1 – add to the Button: #sample-ID
        2 – add to the Anchor Position:

        All the Best!

        • Marco
          Posted on January 31, 2018 at 18:08 Permalink

          2 – add to the Anchor Position:
          <a id="sample-ID"></a>

  13. MandM
    Posted on January 28, 2018 at 04:43 Permalink

    Possible to scroll the pages of a report /document from right to left?
    I’m new to plugins & building website. Sorry if this is not a good question. Thank you

    • malihu
      Posted on January 29, 2018 at 11:31 Permalink

      The plugin works on any direction as long as your page layout is horizontal. You can get an idea by viewing the source HTML of the horizontal demo.

      Please note the the plugin does not scroll overflowed elements (e.g. divs having their own inner scrollbar). It works by scrolling the actual page, so you need to make sure your theme/layout is such.

  14. joe z
    Posted on January 22, 2018 at 21:46 Permalink

    I have a question. Can you put more then 1 selector in the offset field> for exampe: #masthead and .mob-menu together. I am using to 2 menu’s together when it goes mobile. Is that possibl?

  15. Herbert von Kaufmann
    Posted on January 21, 2018 at 00:56 Permalink

    Great plugin, just one question:

    I implemented one page anchor scrolling with your plugin as follows:
    in each row i want to address I add a text element, with no text, but with your target short code (i.e. [ps2id id=’section-2′ target=’section-2 + div’/])
    I am using buttons allocated to the left of the page to address the sections (each button gets the url with the specfic section, i.e. #section-2)
    Now the following issue: when scrolling down (mousewheel) I want to have the button lighlighted, which belongs (addresses) the section. Despite passing the different sections, this does not happen (despite the above advanced short code), is there any way to get that worked?


    • malihu
      Posted on January 21, 2018 at 23:52 Permalink


      I’d need to see your page in order to help and provide an exact solution. Can you post your url?

      • ValleReD
        Posted on January 27, 2018 at 00:39 Permalink

        a bit more specified:

        Scrolling the page NOT Clicking the left buttons (which are using your Plugin) should have the following effect: Button/Link is highlighted, which refers to the section one is currently passing, and when reaching the next section, the button should not be highlighted anymoren, instead the next button when

        • malihu
          Posted on January 29, 2018 at 11:17 Permalink

          You have enabled a couple of options that prevent highlighting from working properly on your layout:

          1)Allow only one highlighted element at a time
          2)Keep the current element highlighted until the next one comes into view
          3)Highlight by next target

          You should normally disable these options and use plugin’s highlight class(es) in your CSS.

  16. Dan Becker
    Posted on January 11, 2018 at 18:11 Permalink

    The following page has some Page Scroll functions on the 6 circular buttons at the top of the page. The also work on the text labels below the circular buttons. These link to various anchor points further down the page. It works fine on desktop, but only the first button (Inspiration) works on mobiles. The others do not do anything.

    Please can you help fix this so it works on mobiles too.


    • malihu
      Posted on January 12, 2018 at 16:02 Permalink

      Firstly, you need to enable the plugin on your icon and text links.
      The easiest/quickest way to do this, is going to “Page scroll to id” settings and change the “Selector(s)” option value to:


      Hit save changes.

      After you do this, test your links (on desktop) and you’ll see the page scroll smoothly to the targets.

      The links do not work on mobile viewports because the elements that contain the targets are hidden via CSS. The hidden elements seem to be the sections images. These are hidden on mobile and the thing is that browsers do not scroll to hidden targets.

      You should move the targets outside of those elements and place them on the sections titles for example.

      FYI: The stylesheet that hides the elements on mobile is:


      and the CSS rule is:

      .vc_hidden-xs { display: none!important; }

      Hope this helps

  17. Sebastian
    Posted on January 10, 2018 at 14:46 Permalink

    the plugin does not work. if I’m outside of a page which is linked with anchors points it works … the page is loaded then I scroll to the point I would like but if I drive within the page another point, the page reloaded.
    I have the plugin on about 5 pages active on no other side is the function as now …

    • malihu
      Posted on January 10, 2018 at 15:08 Permalink

      Make sure your links URL matches exactly your site’s URL (the URL you see in browser’s address bar). For example, if you use the full URL in your links make sure it matches the www, https parts (if these exist).

      If you post your page/website URL I’d be able to see what happens and provide an exact solution, otherwise I can’t really help.

      • sebastian
        Posted on January 11, 2018 at 10:58 Permalink

        this site here:

        the url is: for the points

        i have no idea what to do…

        • Sebastian
          Posted on January 11, 2018 at 11:07 Permalink

          the menu links are here:
          Methode nach dr bach > dr bach strategie > all the links

          ive seen that they not become the tag “data-ps2id-api=”true””

          maybe an js error ?

      • Sebastian
        Posted on January 11, 2018 at 12:20 Permalink

        ok ive fixed that ive change the href to anchorpoint only when iam on current page

        • malihu
          Posted on January 11, 2018 at 15:43 Permalink

          Ok. Your links URL are not correct.

          For example, the link “Wiederherstellungsstrategie” is:


          but this URL does not exist. The link URL should be:


          You should remove the therapie-nach-dr-bach dir from your links. If you do this, you won’t have to change the href on the current page.

          • Sebastian
            Posted on January 12, 2018 at 12:10 Permalink

            oh okay i didnt have seen this, sorry…

            now it works thanks 🙂

  18. Rowan
    Posted on January 5, 2018 at 18:42 Permalink

    I have a custom menu url with #samenstellen, which directs me to that certain page id anchor. which works perfectly when I’m on that page and click the menu item with #samenstellen. However when I’m on a different page lets say /contact, and I press the menu item #samenstellen. It doesn’t go to the page, nor does it go to the page section.

    How can I fix it so, that when even on a different page. It still directs myself to that page and id where its supposed to go.

    • malihu
      Posted on January 6, 2018 at 00:33 Permalink

      Use the full URL in your link. For example, instead of just #samenstellen, use:

  19. Basti
    Posted on January 4, 2018 at 17:20 Permalink

    Hey mahilu,

    thx for this easy-to-use plugin!! 😉

    just one question though…
    setting the offset to a selector or a specific value doesn’t change anything.
    do you have an idea, why this is happening?

    i’m using a floating header, but neither using the header’s height in the plugin’s offset function, nor its id will cause the scrolling to stop any sooner…

    thanks in advance and keep up the good work!



    • malihu
      Posted on January 5, 2018 at 10:07 Permalink


      There’s a chance that your theme has its own function for scrolling the page and handling page anchor links. You can try enabling “Prevent other scripts from handling plugin’s links” option in plugin settings and see if it fixes the issue.

      It’s impossible to say what exactly happens though unless I see your page. If you can post your URL (so I could go and check it), I’d be able to provide an exact solution.

      • Basti
        Posted on January 7, 2018 at 22:42 Permalink

        The preventing option did it!! Thank you!

        If anything comes up again, I will let you know 😉

        Take care.

  20. Tariq
    Posted on December 20, 2017 at 04:48 Permalink

    When I use a button in a widget I have it doesn’t scroll. Is there a special way to have the code apply to buttons btn?

    • malihu
      Posted on December 21, 2017 at 14:25 Permalink

      You can enable the plugin on all links with a hash in their URL (including widget links) by doing the following:

      Go to plugin settings and change “Selector(s)” option value to:


      Save changes and test your button(s).

  21. Luis
    Posted on December 19, 2017 at 22:13 Permalink

    Hello, I followed your video tutorial and it still does not work for me. When I click on a menu item, it does not scroll to the position but I do see URL change at the the end to /#section-1.

    The “Enable on WordPress menu links” options is clicked. I also added the special css class ‘ps2id’ to the CSS classes and I also tried to add the ‘m_PageScroll2id’ to the Link Relation (XFN) option and it still does nothing. Can you help me please?

    P.S – I have not changed the default options that come when the plugin is installed.

    • malihu
      Posted on December 21, 2017 at 14:35 Permalink


      You don’t have any targets in your content. Did you create the targets that your links should scroll to?

      For example, you have a link (“Lease to Own”) with URL #section-2 but you don’t have a target element with id section-2

      You need to create the targets (see tutorial).

  22. Alan
    Posted on December 16, 2017 at 15:43 Permalink

    Is it possible to have an offset for desktop versions and another offset for mobile versions based on a displays height and/or width?



    • Alan
      Posted on December 16, 2017 at 15:52 Permalink

      I solved this issue by using the #masthead selector

  23. J King
    Posted on December 7, 2017 at 19:58 Permalink

    PAGE SCROLL TO ID is awesome. Works like a charm for what I need. One question though…

    The site is:

    I have it set up with my MENU links to go to different parts o f a page. I’m using the ‘wrapper code’ provided:

    [ps2id_wrap id=’some-id’]
    your content…

    BUT it does NOT work at all if you are NOT already on the SAME MENU tab. For example – if Im on the “Reasons To Invest” menu tab and want to go to “Our Technology” – which is under the “Opportunity To Grow” menu tab- you must first click on the “Opportunity To Grow” tab.

    Please let me know if this can be fixed and how.

    Thanks !

    • malihu
      Posted on December 8, 2017 at 00:57 Permalink


      You simply need to add the full address as your links URL/href value instead of just the hash with the id (see this FAQ).

      For example, change the “Crunching The Numbers” link URL from:



      Likewise, “6 Steps To Ownership” from:



      and so on…

  24. Tomas Risberg
    Posted on December 7, 2017 at 16:23 Permalink


    Thank you so much for Page scroll to id. Sridhar Katakam helped me to make it work with the anchor links that the Zotpress plugin creates. I use Zotpress for scientific writing purposes. It handles references.

    I wonder if it would be possible to add some code to Page scroll to id for to create a so called “back-to-where-I-where arrow” from the reference list that Zotpress creates. If you click on an in-text citation in my pages you will now be slowly scrolled to the bottom, but you might then find it difficult to go back to where you were.

    It would be perfect to have a back-to-where-I-where arrow that is presented below the figure of the actual reference in the reference list. Do you think that would be possible?

    Tomas Risberg

    • malihu
      Posted on December 7, 2017 at 18:33 Permalink


      There are 2 basic ways to do this:

      1)Enable “Append the clicked link’s hash value to browser’s URL/address bar” option in plugin settings. This way you can use the browser’s back button to go back to where you were before clicking the link.

      You can also create a link that goes back one browser history step:

      <a href="javascript:history.back()">Back</a>

      2)Create an additional target before each reference link. Then, create a “Go back” link below each reference paragraph that points to the target you created. For example:

      But why do then some robots benefit of sleep [ps2id id='back-to-3'/] [3]?

      3. …Neurophysiol Clin. 2004 Apr;34(2):59–70. [ps2id url='#back-to-3']Back[/ps2id]

      • Tomas Risberg
        Posted on December 8, 2017 at 22:53 Permalink

        Thank you so much. I will contact the developer of Zotpress and ask if she wants to add support for this in the plugin.

  25. Ciska
    Posted on November 28, 2017 at 18:16 Permalink

    I have been using this plugin for some time without hassles. Recently changed my theme and now I have a problem using this from the WordPress menu.

    Your instructions above says “Click to edit each one of the links you’ve created and insert the ps2id value in “CSS Classes” field”

    Now I’m not too technical so help me with the ps2id and the text I have to add here. If my id is named #Travel, is this what I add to that CSS field?

    If I open my use my menu to go to one of these pages, it opens on that spot on the page but jumps right back to the top of the page again. I don’t think it sees my ps2id

    Some help will be appreciated

  26. Tomasz
    Posted on November 28, 2017 at 09:38 Permalink


    Could You hellp me with adding to menu item to scroll to contact widget on the bottom of the page?
    Thank You in advance.
    Best regards

    • malihu
      Posted on November 28, 2017 at 17:00 Permalink

      Give your link the URL:

      You should be able to see the id of any widget in Appearance > Widgets, so you can use this id as the target.


Comments pages: 1 2 3

Post a comment

Cancel reply

Your e-mail is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
You can write or copy/paste code directly in your comment using the <code> tag:
<code>code here...</code>
You may also use the data-lang attribute to determine the code language like so:
<code data-lang-html>, <code data-lang-css>, <code data-lang-js> and <code data-lang-php>