Hi!

A little modification, you can retrieve the index of the currently selected
tab.

$('#example').tabs({
    load: function(event, ui) {
        $('a', ui.panel).click(function() {
             //changes the url for the tab itself and reloads it
rather than just loading content into it
            $('#example').tabs("url", $('#example').tabs('option',
'selected'), this.href).tabs("load",$('#example').tabs('option',
'selected'));
            return false;
        });
    }
});



Fontzter-2 wrote:
> 
> However, it may be better to call the tabs load if you know the index
> of the tab you are loading.  This would reapply the click event to the
> links (again, not tested):
> 
> $('#example').tabs({
>     load: function(event, ui) {
>         $('a', ui.panel).click(function() {
>              //changes the url for the tab itself and reloads it
> rather than just loading content into it
>             $(#example).tabs("url", 1, this.href).tabs("load",1);
>             return false;
>         });
>     }
> });
> 
> 
> Hth,
> 
> Dave
> 
> 
> On Sep 20, 7:23 pm, John P <[email protected]> wrote:
>> Hello,
>>
>> You can view an example of my problem here. Hopefully this illustrates
>> better than my poor articulation :)
>>
>> http://johnpancoast.com/tabs
>>
>> On Sep 18, 7:17 pm, John P <[email protected]> wrote:
>>
>> > Hello,
>>
>> > First of all, my first experiences with jquery UI have been awesome.
>>
>> > Your example
>> athttp://docs.jquery.com/UI/Tabs#...open_links_in_the_current_tab_inste...
>> > for opening links in the current tab recommends doing this.
>>
>> > $('#example').tabs({
>> >     load: function(event, ui) {
>> >         $('a', ui.panel).click(function() {
>> >             $(ui.panel).load(this.href);
>> >             return false;
>> >         });
>> >     }
>>
>> > });
>>
>> > This works, but only for the first page. Meaning this
>>
>> > * I click Tab A which loads a.html with ajax (just an href to the
>> > other page as in examples).
>> > * Above works and the content of a.html has a link to b.html which I
>> > click
>> > * Above works and loads the page in current tab without page reload.
>> > b.html has an href back to a.html.
>> > * When I click above link, it fails and links to b.html without
>> > staying in current tab or current page?
>>
>> > It's almost as if I have to tell jquery to reload the above. Like it
>> > doesn't recognize the above example after one clivk. Thanks in advans
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "jQuery UI" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jquery-ui?hl=en
> -~----------~----~----~----~------~----~------~--~---
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/tabs-%28...open-links-in-the-current-tab-instead-of-leaving-the-page%29-tp25519787s27240p26195904.html
Sent from the jQuery UI Discussion mailing list archive at Nabble.com.

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to