<commit_before>API
===

If you have created a carousel like:

.. code-block:: javascript

    $(function() {
        $('.jcarousel').jcarousel();
    });

You can later call methods on the jCarousel instance like:

.. code-block:: javascript

    $('.jcarousel').jcarousel('scroll', '+=2');


The first argument is the method name. The following arguments are the arguments
for the called method.

Available methods
^^^^^^^^^^^^^^^^^

``.jcarousel('scroll', target [, animate [, callback]])``
    Scrolls to a specific item or relative by a given offset (See section
    :ref:`reference.usage.navigating-the-carousel` for more information about
    the target argument).

    If the argument ``animate`` is given and ``false``, it just jumps to the
    position without animation.

    If the argument ``callback`` is given and a valid callback, it is triggered
    after the animation is finished.

    **Example:**

    .. code-block:: javascript

        $('.jcarousel').jcarousel('scroll', '+=1', true, function() {
            console.log('Animation finished');
        });

``.jcarousel('reload'[, options])``
    Reloads the carousel. This method is useful to reinitialize the carousel if
    you have changed the content of the list from the outside or want to change
    options that affect appearance of the carousel on runtime.

    **Example:**

    .. code-block:: javascript

        $('.jcarousel').jcarousel('reload', {
            'animation': 'slow'
        });

``.jcarousel('destroy')``
    Removes the jCarousel functionality completely. This will return the element
    back to its initial state.

    **Example:**<commit_msg>Extend doc of the scroll method<commit_after>API
===

If you have created a carousel like:

.. code-block:: javascript

    $(function() {
        $('.jcarousel').jcarousel();
    });

You can later call methods on the jCarousel instance like:

.. code-block:: javascript

    $('.jcarousel').jcarousel('scroll', '+=2');


The first argument is the method name. The following arguments are the arguments
for the called method.

Available methods
^^^^^^^^^^^^^^^^^

``.jcarousel('scroll', target [, animate [, callback]])``
    Scrolls to a specific item or relative by a given offset (See section
    :ref:`reference.usage.navigating-the-carousel` for more information about
    the target argument).

    If the argument ``animate`` is given and ``false``, it just jumps to the
    position without animation.

    If the argument ``callback`` is given and a valid function, it is called
    after the animation is finished.

    The function receives as first argument a boolean indicating if a scrolling
    actually happend.

    It can be false for the following reasons:

    * The carousel is already animating
    * The target argument is invalid
    * The carousel is already on the requested position
    * An event has cancelled the scrolling

    **Example:**

    .. code-block:: javascript

        $('.jcarousel').jcarousel('scroll', '+=1', true, function(scrolled) {
            if (scrolled) {
                console.log('The carousel has been scrolled');
            } else {
                console.log('The carousel has not been scrolled');
            }
        });

``.jcarousel('reload'[, options])``
    Reloads the carousel. This method is useful to reinitialize the carousel if
    you have changed the content of the list from the outside or want to change
    options that affect appearance of the carousel on runtime.

    **Example:**

    .. code-block:: javascript

        $('.jcarousel').jcarousel('reload', {
            'animation': 'slow'
        });

``.jcarousel('destroy')``
    Removes the jCarousel functionality completely. This will return the element
    back to its initial state.

    **Example:**
{'fraction_non_alphanumeric': 0.11758502504613762, 'fraction_numerical': 0.0010545742156604272, 'mean_word_length': 3.040468583599574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '773765', 'n_tokens_mistral': 1037, 'n_tokens_neox': 977, 'n_words': 410}