1.0.2 • Published 8 years ago

jquery-levelup v1.0.2

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
8 years ago

jquery-levelup

Simple +1/-1 Animation similar to point accumulation in a video game.

on npm

Latest release npm

Plans

See issues.

Usage

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/libs/jquery-levelup/jquery.levelup.min.js"></script>

<span>counter <span style="font-weight: bold;" id='the_cnt'>0</span></span>

<script>
    var $tc = $('#the_cnt');
    $tc.levelup({'start' : 0});

    $('#incrementBtn').on('click', function(event) {
        $tc.levelup('increment', 1);
        $(this).blur();
    });
    $('#decrementBtn').on('click', function(event) {
        $tc.levelup('decrement', 1);
        $(this).blur();
    });
</script>

Options

You should specify options like in usage example above.

NameTypeDefaultDescription
startinteger0Start value for span.
incrementer/decrementer.boldbooleantrueWhether the incrementerdecrementer is bold
incrementer/decrementer.colorCSS color stringnullChange the incrementerdecrementer's text color
incrementer/decrementer.classstringnullAdd a class to the incrementerdecrementer element
showThousandsbooleanfalseWhether to use a thousands separate everywhere
thousandSepstring","The thousand separator to use
MethodsParams
incrementinteger by which to increment
decrementabsolute value of integer by which to decrement (always positive)
reset
getReturns the current value after all pending animations are completed.

License

Apache License 2.0