Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1355724

    Austin Abell
    Participant

    Hey!

    I’m using the content dock plugin and was trying to have the link open a new window (see screenshot). There isn’t an option for this. Any workaround? Thanks.

    #1356207

    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    You could use this script below to wrap the button of your link with a target blank so that it will open in a new tab.

    Add this code in your customizer > custom > JS:

    jQuery(document).ready(function($){
    	$('.classofyourcontentdockbutton').each(function(){
    		$(this).attr('target', '_blank' );
    	});
    });

    Hope it helps.

    Let us know how it goes.

    Thanks.

    #1356777

    Austin Abell
    Participant

    Awesome, thanks! If you could add this as a feature request for the content dock it would be greatly appreciated! Thanks 🙂

    #1356786

    Austin Abell
    Participant

    Also, how do I give my content dock a class? I don’t see an option to do that on the admin side

    #1357231

    Friech
    Moderator

    Hi There,

    You could tweak the given JS code a little bit to this:

    jQuery(document).ready(function($){
    	$('.classofyourcontentdockbutton').each(function(){
    		$(this).attr('target', '_blank' );
    	});
    	$( ".x-content-dock" ).addClass( "yourClass" );
    });

    Or you could use the default class of content dock.

    x-content-dock

    Thanks.

    #1418132

    Austin Abell
    Participant

    For some reason it isnt working… I used this code:

    jQuery(document).ready(function($){
    $(‘.x-content-dock’).each(function(){
    $(this).attr(‘target’, ‘_blank’ );
    });
    });

    On this page

    https://glassjacobson2.wpengine.com/

    If you scroll down half way the Broker Check image pops up. Any help to make it work?

    Thanks

    #1418621

    Rad
    Moderator

    Hi there,

    It’s wrong, please change it to this

    jQuery(document).ready(function($){
    
    /* open the link in new window */
    
    	$('.x-content-dock > a').each(function(){
    		$(this).attr('target', '_blank' );
    	});
    
    /* add class to your content dock, "yourClass" is a sample, please add your preferred class */
    
    	$( ".x-content-dock" ).addClass( "yourClass" );
    
    });

    Thanks!

    #1419205

    Austin Abell
    Participant

    Awesome that did it. Thanks!

    #1419231

    Prasant Rai
    Moderator

    You are most welcome. 🙂