• Resolved raunhar

    (@raunhar)


    I created the Menu using the plugin. Although it works fine, I want to now, if it is possible to open the menu from dropdown in a new window.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author linux4me2

    (@linux4me2)

    Hi @raunhar,

    Since you’re using a dropdown, Menu In Post uses a little jQuery to open the link:

    jQuery(document).ready(
        function () {
            jQuery('.mip-drop-nav').change(
                function () {
                    document.location.href = jQuery(this).val();
                }
            );
        }
    );

    As you can see from the code, when the selection of a dropdown that has the class “mip-drop-nav” is changed, the code fires and changes the URL of the current window to that of the dropdown’s value attribute.

    There may be a way to override that using a menu ID, but I wasn’t able to get it to work.

    Maybe this is something I should include as a feature? Let me take a look at it and get back to you.

    Plugin Author linux4me2

    (@linux4me2)

    Hi @raunhar,

    I think I’m going to add this as a new feature. I didn’t originally because it’s considered bad form–especially with mobile devices–to force a link to open in a new tab/window, and preferable to leave the option up to the user; however, I think there are use-cases that make it a good idea.

    In the meantime, if you want all your Menu In Post dropdowns to open in a new tab/window, you can modify the code in /wp-content/plugins/menu-in-post/js/main.js to look like this:

    jQuery(document).ready(
        function () {
            jQuery('.mip-drop-nav').change(
                function () {
                    window.open(jQuery(this).val(), "_blank");
                }
            );
        }
    );

    That will force the dropdown to open its links in a new tab/window, depending on how the user’s browser is configured.

    I will post back here when I have an updated version of the plugin that adds the functionality.

    Plugin Author linux4me2

    (@linux4me2)

    I just uploaded version 1.3 of Menu In Post, which honors the “Open link in a new tab” for both the list- and dropdown-styles in Menu In Post.

    I added instructions for opening Menu In Post links in a new tab/window in the Help tab for Menu In Post, which you can see by clicking “Help” in the upper-right corner of the Admin > Tools > Menu In Post Tools page.

    It’s worth noting that the settings in the user’s browser will determine whether links will open in a new tab or window.

    I am going to mark this thread as resolved, but I’ll watch it in case you have any more questions.

    Thread Starter raunhar

    (@raunhar)

    thanks

    Plugin Author linux4me2

    (@linux4me2)

    You’re welcome. Thanks for the post. I think this should have been a feature all along.

    Good luck with your site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Open page in New Window option’ is closed to new replies.