Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQuery Tab.UI using Next/Previous – Multiple Instances

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #29927
    jjmclaw
    Member

    Hi All,

    New to this JQuery lark and have used the tutorial off here for the Next/Previous buttons which work perfectly.

    I now need to have a second instance of this working on the same page as the first, i’ve tried just copying it but the second one doesn’t work.

    So, could someone point me in the right direction of how I get 2 instances working on the same page.

    Thanks,

    Jay

    #81531
    jjmclaw
    Member

    Hey,

    The code I used was this:

    Code:
    <script type="text/javascript">
    $(function() {

    var $tabs = $(‘#tabs’).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 + "’></a>");
    }

    if (i != 0) {
    prev = i;
    $(this).append("<a href=’#’ class=’prev-tab mover’ rel=’" + prev + "’></a>");
    }

    });

    $(‘.next-tab, .prev-tab’).click(function() {
    $tabs.tabs(‘select’, $(this).attr("rel"));
    return false;
    });

    });
    </script>

    #81783
    jjmclaw
    Member

    Hi All,

    Is anyone able to help me out please?

    Thanks,

    Jay

    #75714
    noahgelman
    Participant

    I’m not sure what you you’re asking. Are you talking about this?

    http://jqueryui.com/demos/tabs/#default

    And are you trying to add previous and next buttons to it?

    #77289
    noahgelman
    Participant

    Oh wait, I see. You are using the jQuery UI Tabs, and added previous and next buttons, but they only work properly on the first click.

    Yes, which tutorial did you use?

    #81801
    noahgelman
    Participant

    https://css-tricks.com/examples/TabsNextPrev/

    Ok, this is what you used. You need to make sure that the classes and Id’s match or else there’s going to be some confliction.

    #80861
    jjmclaw
    Member

    Hey does this mean that I need to copy the JQuery and rename all of the classes, then match the id’s to suite this?

    #93120
    Kenpachi
    Member

    Hello, is there a way that clicking on the content panel, go to the next page? I use it as a image viewer. Sorry for my English

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.