Open geodir-bubble links in new tab

This topic contains 3 replies, has 2 voices, and was last updated by  Paolo 7 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #333301

    tabiLabs Inc
    Full Member
    Post count: 83

    Hello,

    When searching through many listings and comparing places, it can be nice to have results open in a new tab (think Amazon)

    I would like this behavior for my search results (see link at bottom for example), so, I added the following code to the script in the footer:

    
    
    <script>
    jQuery(document).ready(function() {
      jQuery('body.search-results .gd-post-gd_hotel a').attr('target', '_blank');
    
      setTimeout(function (){
         jQuery('body.search-results .geodir-bubble_desc h4 a').attr('target', '_blank');
      }, 4000);
    </script>

    The first part adds the attribute to the listings in the grid perfectly and they open in a new tab.

    I want to add the same attribute to the Bubbles on the map: when you click the marker, the description bubble comes up, I want that link to open in a new tab as well.

    It seemed that even though the DOM was ready, the map bubbles weren’t created yet, so I added a 4 second delay. But it seems hit at miss…

    Is there another way to do this?

    Here is an example of a search:
    Hotels in Kyoto

    Thanks in advance!

    #333688

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    the map bubble content is loaded after you click on each marker. That’s not going to be possible via jquery unless you add the action after someone click on each marker. However there is a hook for that link that you can use. See : https://wpgeodirectory.com/support/topic/map-bubble-infowindow-link-_blank/#post-121407

    Thanks

    #337082

    tabiLabs Inc
    Full Member
    Post count: 83

    You are still my hero, Paolo.

    Thanks as always!

    #337287

    Paolo
    Site Admin
    Post count: 31206

    You are welcome 🙂

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount