开发者

remote jquery nested tabs

I have nested tabs in jquery tabs which are pretty simple to do if we want static jquery tabs

but what if we want nested tabs that the remote page should decide what would be the tabs.

or in other words i want nested tabs in a remote page (or ajaxified)

For example i m calling this page(remote page) through tabs

<div id="container-2">

  <ul>
  <li><a href="#fragment-1a"><span>Section 1a</span></a></li>
  <li><a href="#fragment-1b"><span>Section 1b</span></a></li>

  <li><a href="#fragment-1c"><span>Section 1c</span></a></li>

  </ul>
  <div id="fragment-1a">
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  </div>
  <div id="fragment-1b">
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euism开发者_如何转开发od tincidunt ut laoreet dolore magna aliquam erat volutpat.
  </div>
  <div id="fragment-1c">

  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  </div>

  </div>

In the main page i have

<script type="text/javascript">
$(function(){
$('#tabs').tabs();
$("#container-2").tabs();
});
</script>
<div id="tabs">
        <ul>
                <li><a href="remote.jsp"><span>Requests</span></a></li>
      </ul>
  </div>

But i m not able to get the nested tabs in the remote page.

They are in the simple list form.

Any help

Thanks

Pradyut


You're trying to bind a tabs() to the $('#container-2'), which isn't there. You need to do it after the load of the tab content.

$('#tabs').tabs({
   load: function(event, ui){
     $("#container-2").tabs();
   }
});


the remote itself should have a script

<script type="text/javascript">

  $(function(){
  $('#tabs-2').tabs();
  });
  </script>

the example url here: -

http://pradyut.dyndns.org/WebApplicationSecurity/newtab.jsp


You will need to call the tabs()s function on the #container-2 only after it has been loaded. When you use a remote tab the content is not loaded until the tab is opened, meaning that the content of the tab will not be added to the DOM at the same time $(document).ready() fires. Try this instead:

<script type="text/javascript">
 $(function(){
    $('#tabs').tabs({
     load: function(event, ui) {
        $("#container-2").tabs();
     }
    });
 });
</script>

I haven't tested it, so you may need to fiddle with the code inside of the load function to get it working, but that should get you started anyway.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜