From ebcc67606a3fbcdf6c57655f785de68e70446137 Mon Sep 17 00:00:00 2001 From: Christiaan Rakowski Date: Wed, 19 Jun 2013 21:37:37 +0200 Subject: [PATCH] Added definitions for jquery.tinycarousel 1.9 --- README.md | 1 + .../jquery.tinycarousel-tests.ts | 47 +++++++++++ jquery.tinycarousel/jquery.tinycarousel.d.ts | 79 +++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 jquery.tinycarousel/jquery.tinycarousel-tests.ts create mode 100644 jquery.tinycarousel/jquery.tinycarousel.d.ts diff --git a/README.md b/README.md index ee5753632d..30a4d73892 100755 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ List of Definitions * [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/)) * [jQuery.timeago](http://timeago.yarp.com/) (by [François Guillot](http://fguillot.developpez.com/)) * [jQuery.Timepicker](http://fgelinas.com/code/timepicker/) (by [Anwar Javed](https://github.com/anwarjaved)) +* [jQuery.TinyCarousel](http://baijs.nl/tinycarousel/) (by [Christiaan Rakowski](https://github.com/csrakowski)) * [jQuery.TinyScrollbar](http://baijs.nl/tinyscrollbar/) (by [Christiaan Rakowski](https://github.com/csrakowski)) * [jQuery.Transit](http://ricostacruz.com/jquery.transit/) (by [MrBigDog2U](https://github.com/MrBigDog2U)) * [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov)) diff --git a/jquery.tinycarousel/jquery.tinycarousel-tests.ts b/jquery.tinycarousel/jquery.tinycarousel-tests.ts new file mode 100644 index 0000000000..9a69c06590 --- /dev/null +++ b/jquery.tinycarousel/jquery.tinycarousel-tests.ts @@ -0,0 +1,47 @@ +/// + +$('#slider1').tinycarousel(); + +$('#slider2').tinycarousel({ display: 2 }); + +$('#slider3').tinycarousel({ pager: true, interval: true }); + +$('#slider4').tinycarousel({ controls: false, pager: true, animation: false }); + +$('#slider5').tinycarousel({ axis: 'y' }); + +var oSlider7 = $('#slider7'); + +oSlider7.tinycarousel({ interval: true }); + +//The tinycarousel_move method you can use to make a anchor to a certain slide. +$('#gotoslide4').click(function () { + oSlider7.tinycarousel_move(4); + return false; +}); + +//The tinycarousel_start method starts the interval. +$('#startslider').click(function () { + oSlider7.tinycarousel_start(); + return false; +}); + +//The tinycarousel_stop method stops the interval. +$('#stopslider').click(function () { + oSlider7.tinycarousel_stop(); + return false; +}); + +$(document).ready(function () { + $('#slider-code').tinycarousel(); +}); + +$(document).ready(function () { + $('#slider-code').tinycarousel({ pager: true }); +}); + +$('#slider-code').tinycarousel({ + callback: function (element, index) { + console.log(element, index); + } +}); \ No newline at end of file diff --git a/jquery.tinycarousel/jquery.tinycarousel.d.ts b/jquery.tinycarousel/jquery.tinycarousel.d.ts new file mode 100644 index 0000000000..83a0301079 --- /dev/null +++ b/jquery.tinycarousel/jquery.tinycarousel.d.ts @@ -0,0 +1,79 @@ +// Type definitions for jQuery tinycarousel 1.9 +// Project: http://baijs.nl/tinycarousel/ +// Definitions by: Christiaan Rakowski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryTinyCarousel { + export interface JQueryTinyCarouselOptions { + /** + * Start block of the carousel. (default: 1) + */ + start?: number; + /** + * Vertical or horizontal scroller? 'x' or 'y'. (default: 'x') + */ + axis?: string; + /** + * How many blocks do you want to move at a time? (default: 1) + */ + display?: number; + /** + * If interval is true and rewind is true it will play in reverse if the last slide is reached. (default: false) + */ + rewind?: boolean; + /** + * Show left and right navigation buttons? (default: true) + */ + controls?: boolean; + /** + * Show page number navigation buttons? (default: false) + */ + pager?: boolean; + /** + * Move to the next block on an interval. (default: false) + */ + interval?: boolean; + /** + * Interval time in milliseconds. (default: 3000) + */ + intervaltime?: number; + /** + * Show animation when changing block? (default: true) + */ + animation?: boolean; + /** + * Time of the animation in miliseconds (default: 1000) + */ + duration?: number; + /** + * Function that executes after every move (default: null) + */ + callback? : Function; + } +} +interface JQuery { + /** + * Creates a new tinycarousel with the specified, or default, options. + * + * @param options The options + */ + tinycarousel(options?: JQueryTinyCarousel.JQueryTinyCarouselOptions): JQuery; + /** + * Moves the tinycarousel to the specified block. + * + * @param index The index of the block to move to + */ + tinycarousel_move(index: number): void; + + /** + * Starts the interval. + */ + tinycarousel_start(): void; + + /** + * Stops the interval. + */ + tinycarousel_stop(): void; +} \ No newline at end of file