Jquery UI Tabs, how do you perform page navigation without ajax?
How can you perform page navigation with Jquery tabs without the ajax events firing? Following the tutorial, I added
$("#tabs").tabs({
select: function (event, ui) {
var url = $.data(ui.tab, 'load.tabs');
if (url) {
location.href = url;
return false;
}
return true;
}
});
And I added hrefs to the tabs going to other pages. The problem is, I have ajax used on the page and onload it posts to the url with an ajax call. I was hoping to disable ajax altogethe开发者_StackOverflow中文版r for the tabs and just use them for straight navigation so I can leverage the styles.
I recently implemented jquery tabs, but modified it to suit my own needs. Basically all it is now is a formatted unordered list, and I change the CSS of the selected tab whenever it is clicked. Then the normal 'a' tag click event handles the href get. This is my Javascript and HTML:
function tabClickEvent() {
$('div.nav ul.tabNavigation a').click(function () {
$('div.nav ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
});
}
<div class="nav">
<ul class="tabNavigation">
<li class="tabbutton"><a href="<%= Url.RouteUrl("main") %>" id="all">all</a></li>
<li class="tabbutton"><a href="<%= Url.RouteUrl("wants") %>" id="wants">wants</a></li>
<li class="tabbutton"><a href="<%= Url.RouteUrl("needs") %>" id="needs">needs</a></li>
</ul>
</div>
精彩评论