Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #315530

    thecashbag
    Participant

    I have a button (made on a Cornerstone page) that I don’t want to link anywhere.

    It’s a “Buy Now” button with a tooltip that comes up when clicked saying “Sorry, sold out”. I don’t want the button to point to any URL right now. I just want the tooltip to appear when clicked and nothing else.

    I have removed everything from the HREF field, but still when you click the button it reloads the page and which sends the user back to the top of the page and they never see the tooltip.

    How can I remove the link all together so this doesn’t happen?

    #315531

    thecashbag
    Participant
    This reply has been marked as private.
    #315641

    Lely
    Moderator

    Hello There,

    To disable link function, please add class disable-link to your button then add the following JAVASCRIPT code in Appearance > Customizer > Custom > Javascript.

    jQuery(function($){

    $('.disable-link').on('click', function(e){ 
      e.stopPropagation();
        e.preventDefault();
       });
    
    });

    Hope this helps.

    #340633

    thecashbag
    Participant

    Sorry for the late reply.

    I cannot see an option in cornerstone to add a class to the button.

    #340659

    Rue Nel
    Moderator

    Hello There,

    Please turn on the advance controls and you can add a class to the button.

    Let us know if this has been helpful to you.

    #661094

    Tristan A
    Participant

    Hi there!

    I just implemented this solution. Unfortunately, it doesn’t seem to work.

    I have buttons that are embedded in a thrive leads shortcode, which opens up a 2 step optin. Unfortunately, the user is then also scrolled to the bottom of the page.

    So I tried the javascript here. It doesn’t work.

    I tried another button, this time without the thrive leads shortcode. In that case, it also doesn’t work.

    Any thoughts?

    #661099

    Tristan A
    Participant
    This reply has been marked as private.
    #661173

    Zeshan
    Member

    Hi there,

    You can try this code instead:

    jQuery(document).ready(function($) {
      $('.disable-link').on('click', function(e){ 
        e.stopPropagation();
        e.preventDefault();
      });
    });
    

    Thank you!

    #661292

    Tristan A
    Participant

    OK that did work

    Unfortunately, it also stops the lightbox from popping up!.

    #661434

    Zeshan
    Member

    Hi Tristan,

    Thanks for updating the thread! The provided code is just to disable the link. We cannot guarantee if it will work with 3rd party scripts or plugins. That said, we cannot provide support for third party plugins or scripts. You may wish to consult a developer to assist you with this. https://community.theme.co/custom-development/

    Thank you for your understanding. Take care!

    #661438

    Tristan A
    Participant

    Off course, I fully understand. I had already contacted the guys from Thrive Leads to get a solution from them.

    Thanks!

    #661697

    Lely
    Moderator

    Hello Tristan,

    Thank you for understanding.

    Always,
    x

    #665804

    Tristan A
    Participant

    Ok guys,

    I am talking to the guys over at Thrive to get this fixed. Hopefully, I can get the JS code adapted to still be able to activate the lightbox but prevent the scrolling.

    Would you mind providing a bit of background as to how the standard x-theme button scroll behavior is working:

    I created a simple test page with lots of text and a number of x-theme button shortcodes in there, all without an actual link. From the behavior there, my conclusion is that X-buttons that do not have a link added to them, by default link to “#”. Is that correct?

    #666153

    Rad
    Moderator

    Hi Tristan,

    Buttons without links will be linked to its current page, hence reloading. That’s a default behavior of all browsers. If your button has #, then it should link to top, again it’s browser’s behavior. But it shouldn’t scroll.

    What you need is this,

    jQuery( function($) {
    
    $('.disable-link').on('click', function(e) { 
        e.preventDefault();
        setTimeout( function() { $('html, body').stop(); }, 90 );
    } );
    
    } );
    

    Stop reloading and linking to top, and stop scrolling too.

    Thanks.

    #667271

    Tristan A
    Participant

    THanks!!