• Resolved bigh3ad

    (@bigh3ad)


    The animation is working only when i load the page with the ‘#’ in the url.

    When i click on the menu link ‘CAMERE’, it goes to the section with that id, but not with the animation.

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

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

    (@malihu)

    Can you give me access to your site/page to check what happens?

    You can also try enabling “Prevent other scripts from handling plugin’s links” option in plugin settings.

    Thread Starter bigh3ad

    (@bigh3ad)

    You can now access the site.

    Plugin Author malihu

    (@malihu)

    Ok, go to plugin settings and in the “selectors are excluded” field, change the following value:

    a[data-toggle]:not([data-toggle='tooltip'])

    to:

    a[data-toggle]:not([data-toggle='tooltip']):not([data-toggle='dropdown'])

    Scroll down and enable “Prevent other scripts from handling plugin’s links” option.

    Save changes, test and let me know

    Thread Starter bigh3ad

    (@bigh3ad)

    No, it’s not working

    Plugin Author malihu

    (@malihu)

    OK. In plugin settings add the following value to the “Prevent other scripts from handling plugin’s links selector(s)” field:

    .mobile_menu

    Save changes and let me know.

    If the above doesn’t work you’ll need to manually edit a specific script in your theme which actively prevents the plugin from scrolling the page to the target.

    Thread Starter bigh3ad

    (@bigh3ad)

    Now it’s working 🙂

    But if i try to go on the link from another page it doesn’t work (from the footer menu it works).

    Plugin Author malihu

    (@malihu)

    This is because the link default behavior is blocked by bootstrap as it’s considered a dropdown. Can you add the following code in your theme/child-theme functions.php?

    function ps2id_custom_script(){
    	wp_register_script( 'ps2id-custom-script', '', array('jquery', '', true );
    	wp_enqueue_script( 'ps2id-custom-script' );
    	wp_add_inline_script( 'ps2id-custom-script', '(function($){
    		$(function(){
    			$(document).on("click","a.dropdown-toggle.__mPS2id[href*='#']:not([href='#']):not(._mPS2id-h)",function(){
    				window.location.href=$(this).attr("href");
    			});
    		});
    	})(jQuery);');
    }
    add_action( 'wp_enqueue_scripts', 'ps2id_custom_script' );

    This should fix the issue. Try it and let me know.

    Thread Starter bigh3ad

    (@bigh3ad)

    Just added the function on functions.php but it’s not working.

    I had to change the function like this:

    function ps2id_custom_script(){
    	wp_register_script( 'ps2id-custom-script', '', array('jquery', '', true ));
    	wp_enqueue_script( 'ps2id-custom-script' );
    	wp_add_inline_script( 'ps2id-custom-script', '(function($){
    		$(function(){
    			$(document).on("click","a.dropdown-toggle.__mPS2id[href*=\'#\']:not([href=\'#\']):not(._mPS2id-h)",function(){
    				window.location.href=$(this).attr("href");
    			});
    		});
    	})(jQuery);');
    }
    add_action( 'wp_enqueue_scripts', 'ps2id_custom_script' );

    “)” was missing in the second line.

    I had to add “\” before the quotes inside the hrefs.

    • This reply was modified 2 years, 4 months ago by bigh3ad.
    Plugin Author malihu

    (@malihu)

    Ah yes, the typo was my bad.

    It works now when I test it, correct?

    Plugin Author malihu

    (@malihu)

    Ah there’s a mistake in the code when you added the “)”. Change it to:

    function ps2id_custom_script(){
    	wp_register_script( 'ps2id-custom-script', '', array('jquery'), '', true );
    	wp_enqueue_script( 'ps2id-custom-script' );
    	wp_add_inline_script( 'ps2id-custom-script', '(function($){
    		$(function(){
    			$(document).on("click","a.dropdown-toggle.__mPS2id[href*=\'#\']:not([href=\'#\']):not(._mPS2id-h)",function(){
    				window.location.href=$(this).attr("href");
    			});
    		});
    	})(jQuery);');
    }
    add_action( 'wp_enqueue_scripts', 'ps2id_custom_script' );
    Thread Starter bigh3ad

    (@bigh3ad)

    Now it’s working, thank you 🙂

    Plugin Author malihu

    (@malihu)

    You’re welcome 🙂

    Marking this as resolved but let me know if you need more help.

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

The topic ‘Scroll animation working only on page load’ is closed to new replies.