Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #550302

    Hi
    I’m using masonry gallery within a color-section for opening url’s with target _blank. Found that solution in this forum:

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘#av-masonry-1 a’).attr(‘target’,’_blank’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘add_custom_target’);

    https://kriesi.at/support/topic/portfolio-grid-links-not-opening-in-new-window/#post-346592

    This works fine, until I’m using the “Load More” Button. The links of the new loaded images are not longer _blank. How could I resolve this problem? Thanks for your help.

    I hope, in the future, there will be the possibility to chose the target within masonry.

    #551553

    Hi baiker!

    Thank you for using Enfold.

    Please replace the code with this:

    function add_custom_script(){
    ?>
    <script>
    (function($){
        $('.av-masonry a:not(".av-masonry-pagination")').attr('target','_blank');
    
        $('.av-masonry-pagination').click(function() {
                setTimeout(function() { $('.av-masonry a:not(".av-masonry-pagination")').attr('target','_blank'); }, 3000);
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Remove browser cache then reload the page.

    Best regards,
    Ismael

    #552981

    Hi Ismael

    You’re the hero!! Thanks, works perfect.

    Best regards,
    René

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Masonry Gallery, target _blank with load more button’ is closed to new replies.