Documentation

Table of Contents

Available Options

scroll_distance - Pixel width distance for each scroll click. Default: 300 pixels.


scroll_duration - Animation time for scrolling in milliseconds. Default: 300 milliseconds.


left_arrow_size - Pixel width for the scroll button on the left side. Default: 26 pixels


right_arrow_size - Pixel width for the scroll button on the right side. Default 26 pixels.


click_callback - Callback function on click. Accpets the click event object as an argument. The default callback function will change the page to the href in the 'rel' attribute of the item's span tag.


Usage

    $('#tabSet').scrollTabs({
      scroll_distance: 350,
      scroll_duration: 350,
      left_arrow_size: 26,
      right_arrow_size: 26,
      click_callback: function(e){
        var val = $(this).attr('rel');
        if(val){
          window.location.href = val;
        }
      }
    });

JavaScript API

The returned object will have the following methods.

      var tabSet = $('#tab_set').scrollTabs();
      tabSet.addTab('<span>Hi</span>');

domObject - Access the DOM Object that this TabSet was created on.


addTab(html, position) - Add a tab to the ScrollTabs interface. The new tab is created from the HTML string that you pass to this method. Providing an HTML string provides you with the full flexibility to augment your span tag fully to meet the needs of your specific use-case. Optionally, you may pass a position value, which if not provided will default to placing the new tab as the last tab. The positions are zero-indexed, and the new tab will shift all items at and past the indicated position down one item.

    // Place a new tab into the first position
    tabSet.addTab('<span>Hi</span>', 0);

removeTabs(jQuerySelector) - Removes all the items that are returned by the jQuery selector string (scoped within this object).

    // Remove the span with a specific ID
    tabSet.removeTabs('#tab_id');

    // Remove the first span, a couple of options
    tabSet.removeTabs('span:eq(0)');
    tabSet.removeTabs('span:nth-child(1)');

clearTabs() - Removes all the items in this ScrollTabs object.


destroy() - Destroys the ScrollTabs instance formatting, leaving only the raw HTML contents. This is effectively the opposite of the ScrollTabs initialization.


hideTabs(jQuerySelector) - Hide tabs based on the jQuery Selector. This is for situations where you may not want to completely remove a tab, but want to temporarily hide it.


showTabs(jQuerySelector) - Shows hidden tabs based on the jQuery Selector.

CSS Selectors

You can override the basic styling CSS to make the look of the tabs as unique as you'd like!

.scroll_tabs_container - Wrapper for the interface. This is the DOM object you called .scrollTabs() on.


div.scroll_tab_inner - This is a wrapper for the individual tabs themselves. Does not include the left/right scrolling buttons.


div.scroll_tab_inner span - The individual items that will be scrolled. Additional classes for various states will be applied to these DOM objects, such as .scroll_tab_first (First Item), .scroll_tab_last (Last Item), .scroll_tab_over (Hover), and .tab_selected (Selected/Depressed).


div.scroll_tab_inner span.scroll_tab_left_finisher - A DOM element inserted so that you can (should you want) add some extra styling to the left of the tabs, when the scroll buttons are hidden. Make the padding and width of the element 0 should you not need it.


div.scroll_tab_inner span.scroll_tab_right_finisher - A DOM element inserted so that you can (should you want) add some extra styling to the right of the tabs, when the scroll buttons are hidden. Make the padding and width of the element 0 should you not need it.


.scroll_tab_left_button - The DOM element for the left button (that scrolls the grouping left). Additional selectors available to change the styling under the specified circumstances: .scroll_tab_left_button_over (Hover) and .scroll_tab_left_button_disabled (Not Clickable--already scrolled all the way in this direction).


.scroll_tab_right_button - The DOM element for the right button (that scrolls the grouping right). Additional selectors available to change the styling under the specified circumstances: .scroll_tab_right_button_over (Hover) and .scroll_tab_right_button_disabled (Not Clickable--already scrolled all the way in this direction).

Mouse Wheel Scrolling

Mouse wheel scrolling requires the jQuery Mousewheel plugin to be installed, which is bundled with this download. All credit goes to Brandon Aaron (http://brandonaaron.net) for this fantastic plugin.

Disabling Mouse Wheel Scrolling: simply do not include the jQuery Mousewheel plugin.