Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #989597
    isearchlocal
    Participant

    Hi guys again…..

    sorry to bother you all.

    I use this JS below to make the feature box image clickable. It works a treat except one little thing.
    It always opens the link on a new tab. I would like to make it so it opens on the same – basically not opening up a new tab.
    Any ideas please?? thank you

    jQuery(document).ready(function($) {
    $(‘.x-feature-box’).each(function() {
    var self = $(this),
    icon_href = self.find(‘.x-feature-box-text a:last-child’).attr(‘href’);
    if ( icon_href.length > 0) {
    $(self).find(‘.x-feature-box-graphic-inner > *’).wrap(function() {
    return ‘‘;
    });
    }
    });
    });

    #989714
    Joao
    Moderator

    Hi There,

    Can you check if the option Open link in New Window inside the Feature Box Element in Cornerstone is not turnned on?

    If it is not please provide the URL of your website so we can have a better look.

    Thanks,

    Joao

    #990415
    isearchlocal
    Participant

    hi yes all the options are set to no.

    when i click the texts it doesn’t open a new tab, however when i click the images it does.
    it must be somewhere in the above code??

    #990827
    Friech
    Moderator

    Hi There,

    Please provide us your site URL so we can take a closer look.

    Thanks.

    #995082
    isearchlocal
    Participant
    This reply has been marked as private.
    #995098
    Christopher
    Moderator

    Hi there,

    Please add this JS as well:

    jQuery(".x-feature-box-graphic-inner a").attr("target","_parent");

    Hope it helps.

    #995143
    isearchlocal
    Participant

    sorry no, didnt work this is the JS code in full now

    jQuery(document).ready(function($) {
    $(‘.x-feature-box’).each(function() {
    var self = $(this),
    icon_href = self.find(‘.x-feature-box-text a:last-child’).attr(‘href’);
    if ( icon_href.length > 0) {
    $(self).find(‘.x-feature-box-graphic-inner > *’).wrap(function() {
    return ‘‘;
    });
    }
    });
    });

    jQuery(“.x-feature-box-graphic-inner a”).attr(“target”,”_parent”);

    #995206
    Christopher
    Moderator

    Hi there,

    If you are using cache plugin, please clear cache.
    Would you please provide us with login credentials so we can take a closer look?

    Thanks.

    #995265
    isearchlocal
    Participant
    This reply has been marked as private.
    #995313
    Joao
    Moderator
    This reply has been marked as private.
    #995339
    isearchlocal
    Participant
    This reply has been marked as private.
    #995446
    Christopher
    Moderator

    Hi there,

    Please remove the code I recommended in previous replay and update this code :

    jQuery(document).ready(function($) {
      $('.x-feature-box').each(function() {
        var self = $(this),
            icon_href = self.find('.x-feature-box-text a:last-child').attr('href');
        if ( icon_href.length > 0) {
          $(self).find('.x-feature-box-graphic-inner > *').wrap(function() {
            return '<a href="' + icon_href + '" target="_blank"></a>';
          });
        }
      });
    });

    To :

    jQuery(document).ready(function($) {
      $('.x-feature-box').each(function() {
        var self = $(this),
            icon_href = self.find('.x-feature-box-text a:last-child').attr('href');
        if ( icon_href.length > 0) {
          $(self).find('.x-feature-box-graphic-inner > *').wrap(function() {
            return '<a href="' + icon_href + '" target="_parent"></a>';
          });
        }
      });
    });

    Hope it helps.

    #995520
    isearchlocal
    Participant

    ABSOLUTELY AMAZING!!

    thank you Christopher.

    #995708
    Rahul
    Moderator

    You’re welcome!

    #1092393
    [email protected]
    Participant

    This is great. Thank you team for providing this JS code.

  • <script> jQuery(function($){ $("#no-reply-989597 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>