Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #737965

    Hello!

    I am using the following code to allow my masonary grid items to open in a new window. I put it in my function page, and it works great. Thank you!

    The thing is, it would be great if this could be customized so that I can pick and choose which page/post that uses the function (opens a new window). There are sometimes I need the windows to open in a new window but others I need it to remain within the same experience.

    Any help is apprecated.
    .

    <script>
    jQuery(window).load(function(){
    jQuery('.av-masonry a').each(function(){
    jQuery(this).attr('target', '_blank');
    });       
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');
    #739744

    Hey CPM_usa,

    At the moment we don’t have any custom snippets or work-around for that except the one has been given, we will try to make one. Please feel free to request – or vote if already requested – such feature on Enfold feature request form.

    Best regards,
    Nikko

    #743620

    Thank you for responding… I saw a response where someone suggested putting the following code on the button but suggested to first switch to “Editor” The thing is, when I switch to the editor, nothing is there, which is odd because stuff should be there.

    <script type = “text/javascript”>
    jQuery(‘.av-masonry-container a’).attr(‘target’, ‘_blank’);
    </script>

    #745612

    Hi,

    You would need to change this part of the code:

    jQuery(‘.av-masonry-container a’).attr(‘target’, ‘_blank’);

    to this one:

    jQuery('.page-id-xx .av-masonry-container a').attr('target', '_blank');

    where xx is the page id number. Hope this helps.
    Best regards,
    Nikko

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