Skip to content

Commit

Permalink
Reuse previous parameters when calling auto(), Update README and vers…
Browse files Browse the repository at this point in the history
…ioning
  • Loading branch information
bchanx committed Feb 16, 2014
1 parent e33daa3 commit b539c69
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 49 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Full details on available settings listed below:
| `fade` | _bool_ | true | Whether slide transitions should fade in/out. `true` or `false`. |
| `keyboard` | _bool_ | false | Whether to enable keyboard navigation upon mouseover. `true` or `false`. |
| `overflow` | _bool_ | false | Whether to overflow transitions at slidr borders. `true` or `false`. |
| `pause` | _bool_ | false | Whether to pause on mouseover when running in auto(). `true` or `false`. |
| `theme` | _string_ | #fff | Sets color theme for breadcrumbs/controls. `#hexcode` or `rgba(value)`. |
| `timing` | _object_ | {} | Custom animation timings to apply. `{'transition': 'timing'}`. |
| `touch` | _bool_ | false | Whether to enable touch navigation for mobile devices. `true` or `false`. |
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "slidr",
"main": "slidr.js",
"version": "0.4.0",
"version": "0.5.0",
"homepage": "https://github.com/bchanx/slidr",
"authors": [
"bchanx <[email protected]>"
Expand Down
18 changes: 10 additions & 8 deletions slidr.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,17 +1170,19 @@
auto: function(_, msec, direction) {
if (_.started && slides.isdir(direction)) {
actions.stop(_);
_.auto = setInterval(function() {
_.auto.msec = msec;
_.auto.direction = direction;
_.auto.id = setInterval(function() {
if (!(_.settings['pause'] && nav.mouse.isOver(_.id))) slides.slide(_, direction);
}, msec);
}
},

// Stops auto transitioning.
stop: function(_) {
if (_.started && _.auto) {
clearInterval(_.auto);
_.auto = null;
if (_.started && _.auto.id) {
clearInterval(_.auto.id);
_.auto.id = null;
}
},

Expand Down Expand Up @@ -1238,8 +1240,8 @@
// The current slide.
current: null,

// Whether auto() is currently active. Stores the timer interval id.
auto: null,
// The auto() metadata.
auto: { id: null, msec: 5000, direction: 'right' },

// A {mapping} of slides to their neighbors.
slides: {},
Expand Down Expand Up @@ -1308,7 +1310,7 @@
*/
'auto': function(opt_msec, opt_direction, opt_start) {
actions.start(_, opt_start);
actions.auto(_, opt_msec || 5000, opt_direction || 'right');
actions.auto(_, opt_msec || _.auto.msec, opt_direction || _.auto.direction);
return this;
},

Expand Down Expand Up @@ -1401,7 +1403,7 @@
'fade': true, // Whether slide transitions should fade in/out. `true` or `false`.
'keyboard': false, // Whether to enable keyboard navigation upon mouseover. `true` or `false`.
'overflow': false, // Whether to overflow transitions at slidr borders. `true` or `false`.
'pause': false, // Whether to pause on mouseover for slidr's running in auto(). `true` or `false`
'pause': false, // Whether to pause on mouseover when running in auto(). `true` or `false`.
'theme': '#fff', // Sets color theme for breadcrumbs/controls. #hexcode or rgba(value).
'timing': {}, // Custom animation timings to apply. {'transition': 'timing'}.
'touch': false, // Whether to enable touch navigation for mobile devices. `true` or `false`.
Expand Down
Loading

0 comments on commit b539c69

Please sign in to comment.