We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2912
    • 315 Posts
    I've searched best I can to find something on the above but alas I couldn't. I'm having a problem with jquery UI tabs and modx Evo.

    My specs are:
    Modx: Evo 1.0.12
    PHP 5.2.17
    Apache: 2.0.64
    MySQL: 5.0.77
    jQuery 1.10.2
    jQuery UI: 1.10.3

    running on Windows 2008 Server.

    The problem I'm having is with the web page. Without using tabs or using a very old version of jQuery and jQuery UI everything works as expected. When I update the scripts then things just go wrong.

    The page loads ok.
    jQuery Tabs kicks in.

    Where the tabs should generate I get a a rendition of the site home page and then the tabs! This happens whether I'm logged in to the manager or not. My HTML code is clean there doesn't appear to be any duplications where scripts are concerned.

    I've tried this on two different systems and the result is the same.

    I hope someone else has had the same problem or can point me in a direction to help. I really would like to use tabs on my pages.

    Thanks,

    BBloke

    This question has been answered by multiple community members. See the first response.

      BBloke
    • discuss.answer
      • 4172
      • 5,888 Posts
      try to change

      href="#tabs-1"


      to

      href="[[~[[*id]]]]#tabs-1"


      [Edit]

      for EVO try

      href="[~[*id*]~]#tabs-1"

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        • 2912
        • 315 Posts
        OMG! It's been driving me absolutely crazy!!!!!!! Thank you for a quick reply. Genius... I have a few other choice words but they are aimed at jquery!!!
          BBloke
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That is a known problem with JQueryUI tabs since version 9. It's incompatible with the <base href...> tag. The JQueryUI developers are of the opinion that that tag is Evil and should never be used, and have no intention of working with it.

          There is a javascript patch to fix it.
          http://bugs.jqueryui.com/ticket/8637
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 2912
            • 315 Posts
            This is a follow up issue I'm having which relates UI Tabs.

            If I call a webpage with URL parameters the result is the same as originally described.

            Would anyone know if there is a cure for this? It doesn't matter what parameters are passed. Any just stuff the page up.

            BBloke
              BBloke
              • 2912
              • 315 Posts
              aha I actually found a very nice work around on stack overflow:
              http://stackoverflow.com/questions/13837304/jquery-ui-non-ajax-tab-loading-whole-website-into-itself

              $("#productTabs UL LI A").each(function() {
                  $(this).attr("href", location.href.toString()+$(this).attr("href"));
              });
              $("#productTabs").tabs();
                BBloke
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                And I have found a couple of nice tabs that don't work the same way at all. Instead of one block of elements (usually <a> elements) and then another block of divs for the tab panes, it uses simple unordered lists, CSS and a small bit of Javascript.

                The list:
                <ul class="Tabbed Control">
                    <li class="Tab Active">
                        <a class="Name">Resources</a>
                        <div class="Content">
                            <p>Content - resources tab</p>
                        </div>
                    </li>
                    <li class="Tab">
                        <a class="Name">Elements</a>
                        <div class="Content">
                            <p>Content - elements tab</p>
                        </div>
                    </li>
                    <li class="Tab">
                        <a class="Name">Files</a>
                        <div class="Content">
                            <p>Content - files tab</p>            
                        </div>
                    </li>
                </ul>


                The CSS:
                    #TabbedContainer > .Tabbed.Control {
                        position:relative; 
                        width:/* whatever */; 
                        height:/* whatever */;
                    }
                
                
                    .Tabbed.Control > .Tab {
                        position:static;
                        display:inline-block;
                    }
                    .Tabbed.Control > .Tab > .Name {
                        display:block; 
                    }
                    .Tabbed.Control > .Tab > .Content {
                        position:absolute; 
                        left:0;
                        display:none; 
                        width:100%;
                        max-height: /* if you want a height limit. */
                        overflow:auto; /* if height limit is set */
                    }
                    .Tabbed.Control > .Tab.Active > .Name {
                        background-color:#000000; color:#ffffff;
                    }
                    .Tabbed.Control > .Tab.Active > .Content { 
                        display:block; 
                    } 
                


                And the Javascript (JQuery):
                <script>
                $('body').on('click', '.Tab', function(event){
                    event.preventDefault();
                    $('.Tab').removeClass('Active');
                    $(this).addClass('Active');
                })
                </script>
                
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  And there are a few ways of doing tabs in pure CSS, one using radio or input elements and labels for the tabs and the "checked" attribute to maintain tab state. http://tympanus.net/Tutorials/CSS3ContentTabs/index2.html
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org