• Resolved ElvisKa

    (@elviska)


    The plugin works just fine… but only once. If a user clicks a link with the ps2id class for the first time it scrolls to the destination element ID. However, if the visitor scrolls up and clicks the same element again – it doesn’t work.

    “Prevent other scripts from handling plugin’s links (if possible)” doesn’t help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author malihu

    (@malihu)

    There’s another script in your theme that handles page scrolling and prevents “Page scroll to id” from working properly. The script that does this is this one:

    ...themes/stack/style/js/plugins.js

    It seems that the theme script removes the target id after the link is clicked. That’s why it works only the first time the link is clicked (there’s no target id to scroll to after that).

    To solve this, you can try adding a selector for “Prevent other scripts…” option. Go to plugin settings and set the “Prevent other scripts from handling plugin’s links selector(s)” option value to:

    a[href*='#']:not([href='#'])

    Save changes and test.

    If the above doesn’t work, you’ll need to add an extra js script in your theme/template. If you can do this, you can add the following in your theme/child-theme footer.php just before the closing body tag (</body>):

    <script>
    (function($){
    	$(function(){
    		ps2idSmoothScrollFix();
    	});
    	$(window).on("load",function(){
    		ps2idSmoothScrollFix();
    	});
    	function ps2idSmoothScrollFix(){
    		$("a.inner-link[href*='#']").removeClass("inner-link");
    	}
    })(jQuery);
    </script>

    This will fix the issue.

    Let me know

    • This reply was modified 4 years, 8 months ago by malihu.
    Thread Starter ElvisKa

    (@elviska)

    Sorry for the late reply. The tweak for foooter.php did the trick!
    Thank you very much!

    Plugin Author malihu

    (@malihu)

    Awesome! You’re welcome 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Scrolling works only once’ is closed to new replies.