[Resolved] Javascript in slideout navigation hook

Home Forums Support [Resolved] Javascript in slideout navigation hook

Home Forums Support Javascript in slideout navigation hook

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #232719
    Jamal

    Hi

    Is it possible to run javascript in the generate_inside_slideout_navigation hook? I tried running a script there but i cant make it work for some reason.

    #232804
    Tom
    Lead Developer
    Lead Developer

    You can run javascript anywhere and it will apply to any element throughout the page – it doesn’t need to be placed anywhere specifically for it to work.

    The best place for javascript is the wp_footer hook.

    Let me know if you need more info ๐Ÿ™‚

    #232884
    Jamal

    I have finally learnt how to enque my scripts, so i did enque the script but i will like to dislay a HTML table inside the slideout navigation. Basically run this code inside the slideout navigation hook

    #232917
    Tom
    Lead Developer
    Lead Developer

    Should be pretty easy, you just need to use the generate_inside_slideout_navigation hook.

    add_action( 'generate_inside_slideout_navigation','jamal_add_slideout_html' );
    function jamal_add_slideout_html()
    {
    ?>
        Your stuff in here
    <?php
    }
    #232953
    Jamal

    That worked, thanks ๐Ÿ™‚

    I have the slideout navigation set to both, please help me with the following:

    1. On desktop hide some/all menu items in the slideout.
    2. On mobile, move menu items above the inside_slideout_navigation hook.

    #233058
    Tom
    Lead Developer
    Lead Developer

    1. You could give those menu item custom classes.

    hide-on-desktop
    hide-on-tablet
    hide-on-mobile

    2. That’s not possible but there is a generate_after_slideout_navigation hook you can take advantage of.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.