Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animation method to Autoscroll plugin #835

Merged
merged 3 commits into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dist/jquery.jcarousel-autoscroll.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jCarousel - v0.3.7 - 2018-02-17
/*! jCarousel - v0.3.8 - 2018-05-31
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
(function($, document) {
Expand Down Expand Up @@ -26,7 +26,8 @@
_options: {
target: '+=1',
interval: 3000,
autostart: true
autostart: true,
method: 'scroll'
},
_timer: null,
_started: false,
Expand Down Expand Up @@ -78,7 +79,7 @@
.one('jcarousel:animateend', this.onAnimateEnd);

this._timer = setTimeout($.proxy(function() {
this.carousel().jcarousel('scroll', this.options('target'));
this.carousel().jcarousel(this.options('method'), this.options('target'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot default option, and please add to documentation about it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}, this), this.options('interval'));

return this;
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.jcarousel-autoscroll.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquery.jcarousel-control.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jCarousel - v0.3.7 - 2018-02-17
/*! jCarousel - v0.3.8 - 2018-05-31
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
(function($) {
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.jcarousel-control.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/jquery.jcarousel-core.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*! jCarousel - v0.3.7 - 2018-02-17
/*! jCarousel - v0.3.8 - 2018-05-31
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
(function($) {
'use strict';

var jCarousel = $.jCarousel = {};

jCarousel.version = '0.3.7';
jCarousel.version = '0.3.8';

var rRelativeTarget = /^([+\-]=)?(.+)$/;

Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.jcarousel-core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jquery.jcarousel-pagination.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jCarousel - v0.3.7 - 2018-02-17
/*! jCarousel - v0.3.8 - 2018-05-31
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
(function($) {
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.jcarousel-pagination.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquery.jcarousel-scrollintoview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jCarousel - v0.3.7 - 2018-02-17
/*! jCarousel - v0.3.8 - 2018-05-31
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
(function($) {
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.jcarousel-scrollintoview.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions dist/jquery.jcarousel.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*! jCarousel - v0.3.7 - 2018-02-17
/*! jCarousel - v0.3.8 - 2018-05-31
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
(function($) {
'use strict';

var jCarousel = $.jCarousel = {};

jCarousel.version = '0.3.7';
jCarousel.version = '0.3.8';

var rRelativeTarget = /^([+\-]=)?(.+)$/;

Expand Down Expand Up @@ -1400,7 +1400,8 @@
_options: {
target: '+=1',
interval: 3000,
autostart: true
autostart: true,
method: 'scroll'
},
_timer: null,
_started: false,
Expand Down Expand Up @@ -1452,7 +1453,7 @@
.one('jcarousel:animateend', this.onAnimateEnd);

this._timer = setTimeout($.proxy(function() {
this.carousel().jcarousel('scroll', this.options('target'));
this.carousel().jcarousel(this.options('method'), this.options('target'));
}, this), this.options('interval'));

return this;
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.jcarousel.min.js

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions docs/plugins/autoscroll/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The plugin accepts the following options:
* [target](#target)
* [interval](#interval)
* [autostart](#autostart)
* [method](#method)

Options can be set either on [initialization](installation.md#setup) or at
[runtime](api.md#reload).
Expand Down Expand Up @@ -67,3 +68,21 @@ $('.jcarousel').jcarouselAutoscroll({
### Default

`true`


method
------

The method to call on the carousel.

### Example

```javascript
$('.jcarousel').jcarouselAutoscroll({
method: 'scrollIntoView'
});
```

### Default

`scroll`
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jcarousel",
"title": "jCarousel",
"description": "Riding carousels with jQuery",
"version": "0.3.7",
"version": "0.3.8",
"homepage": "http://sorgalla.com/jcarousel/",
"author": {
"name": "Jan Sorgalla",
Expand Down
5 changes: 3 additions & 2 deletions src/autoscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
_options: {
target: '+=1',
interval: 3000,
autostart: true
autostart: true,
method: 'scroll'
},
_timer: null,
_started: false,
Expand Down Expand Up @@ -82,7 +83,7 @@
.one('jcarousel:animateend', this.onAnimateEnd);

this._timer = setTimeout($.proxy(function() {
this.carousel().jcarousel('scroll', this.options('target'));
this.carousel().jcarousel(this.options('method'), this.options('target'));
}, this), this.options('interval'));

return this;
Expand Down