jquery Tab - Open Link in current panel does not work -


The content of the tab I'm just starting to play with the Jquery UI tab is initially consistently stabilized content.

Now some content inside the panel has some kind of sub-property so if the user clicks on a link in the panel then I want to change the contents of the current panel with the content coming from the link .

So I used the script directly from jquery ui tab documentation but i can not get it to work. It is always opening the link, not in the panel. The code I use for testing is quite simple:

  & lt; Div id = "mytabs" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#TestTab 1" & gt; Test tab & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#TestTab2" & gt; Test tab & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "testTab1" & gt; Internet advertising Dumm di dumm & lt; A href = "http: // mywebserver / somelink" & gt; Test & lt; / A & gt; & Lt; / Div & gt; & Lt; Div id = "testtab2" & gt; Internet advertising Dumm di dumm 2 & lt; A href = "http: // mywebserver / somelink2" & gt; Test 2 & lt; / A & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('# MyTabs'). Tab ({load: function (event, ui) {$ ('a', ui.panel) .click (function () {$ ( Ui.panel) .load (this.href); returnback;});}});});  

In addition, if I have the contents of the panel using an AJMX call, then any link in the panel is not working.

Any thoughts that I am doing wrong?

Support is really appreciated

Regards

Edit 1:

OK I got some more. I changed javascript with the following snippet:

  $ (function () {$ ("# MyTabs"). Tab (); $ ("# MyTabs"). Bind (' Tabschow ', Function (Event, UI) {AddClickHandler (ui);})}}); Function AddClickHandler (ui) {$ ('a', ui.panel) Click (function () (MyAlert ("AddClickHandler"); $ (ui.panel) .load (this.href, AddClickHandler (ui)); return false;}); }  

After this change, all links on one panel will update the contents of the current panel. So far, so good. I still have left a problem. I can not work for this later link when I have finished the AJAX call, then I try to do this with the second "adclick handler" for callback, with a simple warning, a different function Experimenting is shown that it has actually been called when the content of the panel has been updated. But I can not force anything for new links in that content "$ ('A', ui.panel) ..." does not work, what will be the right selector for it?

Any hint?

Regards

The example looks like this:

  
div id = "" post-text "itemprop =" text ">

" example "& gt; & lt; ul & gt;

  • & lt; a href Lt; li & gt; & lt; duration & gt; content1 & lt; / span & gt; & lt; / a & gt; & lt; / li & gt; content 2 & lt; / li & gt; & lt; li & Lt; a href = "ahah_3.html" & gt; content 3 & lt; / li & gt;
  • Notice, the Links tab itself is in content, not in tab content

    Edit: OK , I think that's your problem. To open those links within the tab, I do not see any code for you, so when a user clicks on a link, it will open a normal link within the browser window. Anyway.

    Try doing something like this:

      $ ("# MyTabs") .Find ("a"). Click (function () {$ (this) .Parent (".ui-tabs-panel"). Load (this.href); return false;});  

    Edit2: I realized that your "load" function does the same thing as I wrote above the function. Anyway, try my work and see if it works, if it moves through firebug with your function and what is different, and if it does not move with firebug with your function .. or online Provide the demo and I can see it

    Edit 3: OK Here's a better solution:

    Add this function:

    < Pre> var bindAjaxLinks = function () {$ ("# MyTabs"). ("A"). (Function () {$ (this) .Parent (".ui-tabs-panel"). Load (this.href, {}, bindAjaxLinks); Details are false;}); } // Add selection function to creator of tabs: $ ("# MyTabs"). Tab ({Select: Function (Event, UI) {bindAjaxLinks ();}, // Your Other Goods}

    Probably not the best solution, since it opens every single click The link will reboot the click function, but it's probably okay, as long as you're creating some production sites


    Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -