Always show the first tabmenu after pageload

Post Reply
mzahl
Posts: 4
Joined: 29 Jun 2015, 15:53

21 Jun 2017, 10:47

Hi,

after loading a page, I want to show always the first tab(active-item, e.g. "Features") without a separate click.

Can you help me, modifying the code?

Thanks!!

Regards,
Martin

User avatar
aragorn
Posts: 3283
Joined: 29 Jun 2013, 12:38

22 Jun 2017, 16:24

Please add the following code into template.xhtml;

Code: Select all

<script type="text/javascript">
//<![CDATA[
 	$(document).ready(function() {
        var $this = PF('myMenu');
        if($this) {
            var link = $this.tabMenuNavLinks.eq(0); // the link of "Features" tab
            link.trigger('click');
        }
    });
//]]>
</script>
in menu.xhtml

Code: Select all

...
        <pa:tabMenu widgetVar="myMenu">
...

mzahl
Posts: 4
Joined: 29 Jun 2015, 15:53

03 Jul 2017, 10:00

Perfect, it works!

Many thanks !!

User avatar
aragorn
Posts: 3283
Joined: 29 Jun 2013, 12:38

03 Jul 2017, 11:59

Glad to hear, thanks for the update!

Post Reply

Return to “Atlantis - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest