I am trying to control tabs through a next/previous function. I am using a particular set of tabs I found in this WEBSITE. The method I am trying to apply I found in this css-tricks WEBSITE. I have replicated everything in my example but i am not getting the desired or any results at all. Can anyone explain to why is it not working? Thank you.
jquery for next/previous functions
<script type="text/javascript">
$(function() {
var $tabs = $('#convertThis').tabs();
$(".ui-tabs-panel").each(function(i){
var totalSize = $(".ui-tabs-panel").size() - 1;
if (i != totalSize) {
next = i + 2;
$(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page »</a>");
}
if (i != 0) {
prev = i;
$(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>« Prev Page</a>");
}
});
$('.next-tab, .prev-tab').click(function() {
$tabs.tabs('select', $(this).attr("rel"));
return false;
});
});
</script>
html
<div id="convertThis">
<div id="tabs">
<div rel="a" href="#a" title="./img/icons/accept.png">Lorem</div>
<div rel="b" href="#b" title="./img/icons/add.png">Ipsum</div>
<div rel="c" href="#c" title="./img/icons/application_home.png">Dolor</div>
</div>
<div id="divs">
<div id="a" class="ui-tabs-panel">
Content for tab item
</div>
<div id="b" class="ui-tabs-panel">
Content for tab item
</div>
<div id="c" class="ui-tabs-panel">
Content for tab item
</div>
</div>
</div>
The html on the first site you referenced isn’t the html for the jQueryUI Tabs panel – it uses a
<ul>and<li>tags for the tabs, not divs.Here’s the HTML syntax for the jQueryUI Tab panel.
Update: Here’s an example using jQueryUI: http://andrewgormley.com/articles/view/jquery-ui-tabs-with-previous-and-next-buttons