Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #1157640

    Hi there
    I put a tab-element and a catalogue into the site and noticed, that the names of the tab are kinda anchor (f. e. kosmetikandnails.ch#nails). It does not work to set a link to the tabs – or at least I do it wrong somehow :-)

    On another section I mentioned the services I offered and wanted to link to the different tabs that shows the catalogue. How do I set that link?

    I tried it with #nails, because I see that link when I hover over the picture. Unfortunately it does not jump there, unlike when I set the anchor to the tabs itself (#preistliste)

    anchor name
    https://prnt.sc/py3v1d

    So… how do I get a link inserted (without using the whole url)?

    Thanks for the help :)

    #1157652

    Hey

    You have to define the anchor ID (e.g. #nails or #preisliste) in the text block itself as well.
    Otherwise WordPress does not know where to jump if you click at the link.

    However, it would be a lot easier to see the website in action so I could help you more specific.

    Cheers
    Michael

    #1157667

    I honestly have no idea where I could put that in – it is just a tab withouth text

    Tab (= Reiter)
    https://prnt.sc/py677t

    #1157670
    #1157696

    Gemäss Doku also nur die Lösung, die ich nicht wollte (und weshalb ich die Topic eröffnet hab) – kein Anker, sondern eine fixe URL, um einen Tab anzuspringen 8-/

    Es funktioniert aber leider nicht mit der URL als Link mit Tab-Ankername.
    Auf https://kosmetikandnails.ch/#angebot sind 4 Einträge, die ich zum Tab mit dem Katalog verlinkt habe. Bei “Nails” habe ich zu https://kosmetikandnails.ch/#nails verlinkt (weil mir bei diesem Tab diese URL angezeigt wurde), aber es springt weder zu diesem Tab noch öffnet es ihn.

    Bei “Kosmetik” habe ich zur Tab-Sektion verlinkt und es springt zu den Tabs (und zeigt mir den Tab, den ich als letztes geöffnet hatte)

    Kann man irgendwo Vorschläge für Verbesserungen anbringen? Wär doch toll, wenn man bei diesem Tab-Element auch pro Tab eine “Developer”-Möglichkeit hätte, um einen Ankernamen zu vergeben. Wäre auch super, wenn es überhaupt funktionieren würde ;-)

    #1157756

    Hallo Christa

    Das müsste schon so klappen, wie du dir das vorstellst.

    Versuche bitte mal folgendes:
    a) Unter https://kosmetikandnails.ch/#angebot verlinkst du “Waxing” mit https://kosmetikandnails.ch/#waxing.
    b) Das sollte dazu führen, dass sich der Tab entsprechend öffnet und die Ansicht entsprechend scrollt.

    Funktioniert das so?

    Übrigens: Ein sogenannter Onepager, wie du ihn hier erstellt hast (also mit Ankern auf der gleichen Seite), ist für Google leider alles andere alles optimal.
    Viel besser wäre es, wenn du einzelne Seiten erstellst, also /angebot, /waxing, etc.

    Viele Grüsse
    Michael

    #1159505

    Hi,
    Sorry for the late reply, please see this post.
    So in your case, Try adding this code to the end of your functions.php file in Appearance > Editor:

    add_action('wp_footer', 'ava_custom_script');
    function ava_custom_script() {
    ?>
    		<script>
     (function($){
                function getQueryParams(qs) {
    			    qs = qs.split("+").join(" ");
    			    var params = {},
    			        tokens,
    			        re = /[?&]?([^=]+)=([^&]*)/g;
    
    			    while (tokens = re.exec(qs)) {
    			        params[decodeURIComponent(tokens[1])]
    			            = decodeURIComponent(tokens[2]);
    			    }
    
    			    return params;
    			}
    
    			var $_GET = getQueryParams(document.location.search);
    
                $(window).load(function() {
                    switch($_GET['tabsort']) {
                        case '1':
                            $('a[data-av-tab-section-title="1"]').trigger('click');
                            break;
                        case '2':
                            $('a[data-av-tab-section-title="2"]').trigger('click');
                            break;
                        case '3':
                            $('a[data-av-tab-section-title="3"]').trigger('click');
                            break;
                        case '4':
                            $('a[data-av-tab-section-title="4"]').trigger('click');
                            break;
                        case '5':
                            $('a[data-av-tab-section-title="5"]').trigger('click');
                            break;
                    }
                });
            })(jQuery);
    </script>
    <?php
    }

    and your link would look like /?tabsort=5 or /?tabsort=#waxing
    If this doesn’t help, please include an admin login in the private content area so we can be of more assistance.

    Best regards,
    Mike

    #1192657

    Hey Mike

    Sorry for the late reply. The code works to open the correct tab – but it reloads the page and you land at the top of the page 8-/
    How can I keep the page from reloading?

    Christa

    #1193100

    Hi,
    I see that when linking directly from another page or site to https://kosmetikandnails.ch/#nails the tab opens but the page doesn’t scroll down to the tab. to correct try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_id_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $("a.av-section-tab-title").each(function() {
       var $this = $(this);       
       var _href = $this.attr("href"); 
       var itemId = _href.substring(1, _href.length);
       $this.attr("id", itemId);
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_id_script');

    it adds an “id” to the tab link so the page will scroll to the tab.
    If the link to the tab is clicked on the same page the offset doesn’t always work so add this code to the end of your functions.php file in Appearance > Editor to apply an offset to the tabs:

    function custom_offset_script(){
      ?>
      <script>
    (function($){
    	var width = $(window).width()
    	if ((width >= 768)) {
        $('a.av-section-tab-title[href*="#"]:not([href="#"])').click(function() {
        var offset = -130; // <-- change the value here
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var target = $(this.hash);
            target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
            if (target.length) {
                $('html, body').animate({
                    scrollTop: target.offset().top + offset
                }, 1000);
                return false;
            }
        
        }
        
    });
    } else {}
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_offset_script');

    Best regards,
    Mike

    #1193125

    well i think it is because your av-layout-tab has only the data-tab-section-id – and maybe this i due to your Enfold Version 4.6.2
    on 4.7.3 these av-layout-tab get the ID ( on your case nails)
    You can do : update to newest version or put this to your child-theme functions.php:

    function tab_section_add_id(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
          $('.av-layout-tab').each(function(){
          var dataID = $(this).data('tab-section-id');
          $(this).attr("id", dataID);
            });
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'tab_section_add_id');

    it will do the job that 4.7.3 did allready.
    i would advice you to update : see here some hints: https://kriesi.at/support/topic/some-hints-and-advice-to-update-enfold/#post-1056107

    #1193200

    Hi,

    @Guenni007
    thank you, that is a good point. @KosmetikAndNails please let us know if updating and using @Guenni007 code above helps.

    Best regards,
    Mike

    #1193221

    with an update the code is then no longer necessary – because enfold 4.7.3 already has these ID’s on the av-layout-tab

    #1193502
    This reply has been marked as private.
    #1193516
    This reply has been marked as private.
    #1193522

    found the problem… seems that there’s only an id available for “Tab Element” but not “Tab Section”-Element. The available options on “Tab Section” are much better, but there’s no ID for the tabs.

    tab-element old & new

    #1193526

    I added all three codes – it works when I link with /?tabsort=name, but it does not add an id-field for the tabs in the development settings of the” Tab Section” -element.

    Maybe there was a missunderstanding with tab-element and tab-section? I use tab-sections where I can use pictures in the tabs, place other elements in a tab and so on. In the “tab-section”-element is no no id-field for the tabs (not even with added code).

    The downside of using all 3 codes: yes, it reloads the side after clicking on a link with /?tabsort=name and scrolls down to the content of the tab. But now it scrolls down immediately when you open the page (I cleared the cache, swapped browsers, opened private tabs).

    Right now I only have this code in the functions.php:

    
    function tab_section_add_id(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
          $('.av-layout-tab').each(function(){
          var dataID = $(this).data('tab-section-id');
          $(this).attr("id", dataID);
            });
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'tab_section_add_id');
    • This reply was modified 4 years, 9 months ago by KosmetikAndNails. Reason: updated the info
    #1193536
    This reply has been marked as private.
    #1193691

    Hi,
    Sorry we couldn’t assist more with a solution, but glad you have a working solution.

    Best regards,
    Mike

    #1193812

    The working solution is to link to #preisliste, not directly to a tab which is why I opened the topic in the first place (so no solution).
    But glad I found out there was an update – why don’t I get an update within WordPress or per mail? I haven’t even seen within the download-area of envato-market that I got an update.

    #1194081

    Hi,
    I see you have the latest version but in your update options in your theme panel your “Envato private token” field is empty, this is necessary for updates in the theme panel to work, but envato-market should also send you emails, you will have to ask envato-market why you are not getting these.

    Best regards,
    Mike

    #1194233

    Oh… thank you so much! Generated, filled in and all set for the updates to come :) Updated my envato-market account as well and should get emails from now on.

    #1194247

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1194271

    But please read carefully: if you have updated the theme to 4.7.3 ( and i see you have done that) then the code : here is obsolete. The Theme Version 4.7.3 has this allready implemented.
    And you link now as described here : https://kriesi.at/support/topic/how-to-link-to-tabs/#post-1157756

Viewing 23 posts - 1 through 23 (of 23 total)
  • You must be logged in to reply to this topic.