Sydnes Services link to _blank page

Hi there,

is it possible to link a service (“Service link” in the service itself) to a page/document which is opened in a new window (target="_blank";)?

Thanks for your help in advance.

Cheers
Charly

Hello Charly,

You can attach target="_blank" on each link of service by doing these steps.

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box

;(function($) {

   'use strict'

  if( $('.widget_sydney_services_type_a').length ) { 

    $('.widget_sydney_services_type_a .service').each(function(){

      $(this).find('a').attr('target', '_blank');
      
    });
    
  }

  if( $('.roll-icon-list').length ) {

    $('.roll-icon-list .service').each(function(){

      $(this).find('a').attr('target', '_blank');
      
    });
    
  }
  

})(jQuery);

  1. Update

Regards,
Kharis

Hey Kharis,

thanks for the quick help!

Is it also possible just for one category of services?

Thank you again!

Cheers
Charly

Do you have a live URL of it? Please share it here, so I can check.

Regards,
Kharis

Hey Kharis,

I’m sorry, no… I’m still working offline. Which information do you need? I’ve several services-categories. Some of those categories are just links to other pages and some of them are download-links. I want the downloads to open in a new window.

Regards
Charly

Replace the code I suggested with this:


;(function($) {

   'use strict'

   if( $('.service').length ) {

      $('.service a[href="http://yoursite.com/link-1"]').attr('target', '_blank');
      $('.service a[href="http://yoursite.com/link-2"]').attr('target', '_blank');
    
    
   }
  
})(jQuery);

The code above means the services which have links to either http://yoursite.com/link-1 or http://yoursite.com/link-2 will open opens in a new tab/window.

Regards,
Kharis

Hello Kharis,

thank you very much. That works.

On this point I want to thank you all - the whole athemes-Support-Team - for the immediate, profound and polite help. Great Job!

Cheers
Charly