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

    Also, on the page (see Private Content) how can we make the whole image be clickable instead of just the text in the portfolio grid?

    #1468461

    because i do not see private content – i guess your page is like this:
    https://kriesi.at/themes/enfold-2017/blog/blog-default/ – and you like to have the link for the whole (Image, heading, excerpt and read-more)
    if you like to have it more specific – use custom classes or page-id’s

    this snippet transfers the first link that could be found in the articel to the slide-entry:

    function transfer_first_link_as_link_to_article(){
    ?>
    <script type="text/javascript">
    window.addEventListener("DOMContentLoaded", function () { 
      (function($) {
          $('.slide-entry').each( function() {
            var LinkSection = $(this).find('a:first').attr('href');
            var LinkTarget = $(this).find('a:first').attr('target');
            if (typeof LinkSection !== "undefined"){
              $(this).on("click", function(){
                if (LinkTarget === "_blank"){
                  window.open(LinkSection, '_blank'); 
                } else {
                  window.location.href = LinkSection;
                };
              });
              $(this).css('cursor','pointer');
            };
          });
      })(jQuery);
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'transfer_first_link_as_link_to_article');
    #1468469

    Hi,

    Thanks for helping out @guenni007 :-)

    Did you try that out and did you have any luck with it @whdsolutions?

    Best regards,
    Rikard

    #1468551

    We would like all the image areas on this page be clickable, not just the text in each entry.

    Not page specific – Just all images and text in the portfolio entries be clickable, its a UX nightmare as it is!

    Screenshot-2024-10-07-104314

    #1468564

    ok – nice to have the page link (on your other topic it is shown):

    there are links on the images too – but they could not be clicked because there is a full overlay of the grid-content
    so no need for a script here

    #top .grid-content {
      pointer-events: none;
    }
    /*** if you do not like to have that image white overlay:*****/
    
    #top .grid-entry .image-overlay {
       display: none !important;
    }

    __________________________
    this will work too – but it is not needed here

    function transfer_first_link_as_link_to_article(){
    ?>
    <script type="text/javascript">
    window.addEventListener("DOMContentLoaded", function () { 
      (function($) {
          $('.grid-content').each( function() {
            var LinkSection = $(this).find('.grid-entry-title a').attr('href');
            var LinkTarget = $(this).find('.grid-entry-title a').attr('target');
            if (typeof LinkSection !== "undefined"){
              $(this).on("click", function(){
                if (LinkTarget === "_blank"){
                  window.open(LinkSection, '_blank'); 
                } else {
                  window.location.href = LinkSection;
                };
              });
              $(this).css('cursor','pointer');
              $(this).find('.image-overlay').css('display','none');
            };
          });
      })(jQuery);
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'transfer_first_link_as_link_to_article');
    #1468589

    PERFECTION!
    Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Whole block clickable – Portfolio Grid’ is closed to new replies.