jquery - Change UI tab according to URL pattern -
I am using the Jquery Ui tab framework. I want to change the selected tab in the URL pattern in the browser such as www. Xyz.com/#tab1 or www.xyz.com/#tab2 I got an alternate solution using
me
$ ("# tab") Bind ('tabsselect', function (event, UI) {window.location.href = ui.tab; However, this tab is selecting anchor, but in fact the tab Do not change and I actually press the Enter key to change the tab. Where is the point where I am wrong and can indicate the change so that tabs change the url pattern.
I To apply, use the following code
$ (document) .ready (function () {$ ("#tabs") .tabs ({beforeLoad: f Quision (Event, UI) {ui.jqXHR.error (function () {ui.pan.html ("This tab could not be loaded. We will try to fix it as soon as possible.");}) ;}}); $ ("# Tab"). Bind ('tabasselt', function event, UI) {window.location.href = ui.tab;});}); HT mL code
& lt; Div id = "tabs" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; Strong class = "first" & gt; & Lt; A href = "# tabs1" id = "tab1" & gt; Tab-1 & lt; / A & gt; & Lt; / Strong> & Lt; / Li & gt; & Lt; Li & gt; & Lt; Strong> & Lt; A href = "xyz.do" id = "tab2" & gt; Tab2 & lt; / A & gt; & Lt; / Strong> & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "tabs1" & gt; Tab-1 content & lt; / Div & gt;
I think you want to force through active handler
$ (".selector"). ("Tabactivate", function (event, UI) {changeColor (ui);}); ui.tab will have details about the tab that was clicked.
In your case, I think you want to say
var change color (ui) = function (if (ui.index == 1) {$ ("# Selector "). AddClass (" tab2Active ");});
Comments
Post a Comment