Okay
  Public Ticket #3733887
Navigating to row / opening up tab with page scroll
Closed

Comments

  •  6
    Eric started the conversation

    Hey guys...

    So I'm not sure if I'm doing this right, but I need to create a text link that will ease me down to a certain row then open up a particular tab. I've been able to accomplish this by using this script: 

    ?tab=Tab#row

    This does work, however instead of easing down to the row it reloads the page and opens the tab which is a bit more of an abrupt experience for the user. You guys did help me figure this out for another page of my website (https://themenectar.ticksy.com//ticket/3599740/), but I love the smooth anchor scrolling of the site and I was just hoping that it would not require a complete page reload.

    So I'm wondering if a) I'm even doing this right and b) is there is a way to accomplish this so the page will scroll and open the tab instead of it needing to reload the page?

    2998811875.png

    Thanks so much guys!

  •  8,938
    Tahir replied

    Hey Again,

    Try adding this snippet to the "Custom JS Code (Head)" in the Salient Theme Options Panel -> General Settings Section:

    <script type="text/javascript">
    jQuery('.reload-page').on('click', function(event) {
    
        event.preventDefault(); 
          var href = jQuery(this).attr('href'); 
             if (window.location.href === href) {
            window.location.reload();
        } else {
            window.location.href = href; 
        }
       return false;
      });
    </script>
    

    In addition the snippet relies on a class name "reload-page" being added to links which are intended to trigger the page reload therefore you will have to add that class name to the button that is triggering the link.

    Thanks.


    ThemeNectar Support Team 

  •  6
    Eric replied

    Thanks Tahir,

    So I've got the code pasted into the Custom Code (Head) 


    1803973850.png

    and because it's just a text link and couldn't see where to add the 'reload-page' class name I added the extend link plugin that allows for a class:

    8669963037.png

    But unfortunately the page still appears to be reloading and then just appearing already scrolling down. Any suggestions?


    Thanks!

  •  8,938
    Tahir replied

    Hey Again,

    Could you allow us to log in to your website backend dashboard so we can check on this for you more?. We are gonna need the username and password of admin user as well as the login url.

    Thanks.


    ThemeNectar Support Team 

  •   Eric replied privately
  •  8,938
    Tahir replied

    Hey Again,

    Sorry for the late turn around, your ticket seemed to slip through the cracks. 

    1. You need to enter the full url for the page to not reload the page: https://prnt.sc/cl8GkAAlDQpp .
    2. Just added a snippet that clicks the correct tab so when you scroll to that anchor the tab is open: https://prnt.sc/s-Eoja4oy_mN

     

    Thanks.


    ThemeNectar Support Team