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

    I’m currently building a new homepage: http://designplanung-leipzig.de/projekt-003/trainingsgruppen/

    You will see two galleries there. The first should (as now) not open a new browser window on click, the second should. So when you click on a logo, a new window with the link should open. How could that be solved? First I installed this code here, but then a new window opens in the upper gallery and I don’t want that:

    function new_custom_script () {
    ?>
    <script>
    (function ($) {
    $ (document) .ready (function () {
    $ (‘. av-masonry-entry’). each (function () {
    $ (this) .attr (‘target’, ‘_blank’);
    });
    });
    }) (jQuery);
    </script>
    <? php
    }
    add_action (‘wp_footer’, ‘new_custom_script’);

    Best regards,
    Martin

    #1242415

    Hi Martin,

    Please try to use this code and put it at the bottom of functions.php of your child theme:

    function masonry_links () {
    ?>
    <script>
    (function ($) {
        $(document).ready (function () {
            var url = new RegExp(location.host);
    
            $('.av-masonry-entry').each(function () {
                if( ! url.test($(this).attr('href')) ) {
                    $(this).attr('target', '_blank');
                }
            });
        });
    }) (jQuery);
    </script>
    <?php
    }
    add_action ('wp_footer', 'masonry_links');

    This code works on Masonry Galleries, if it’s an external link it will open in new tab.
    Hope this helps :)

    Best regards,
    Nikko

    #1242552

    Coooooool – thank you very much Nikko!!!

    #1242616

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1242813

    Close please

    #1242907

    Hi m_reiprich,

    Thanks for using Enfold and have a great day :)

    Best regards,
    Nikko

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Gallery images new and not new browser window’ is closed to new replies.