Skip to content

Commit

Permalink
Merge pull request Victa#22 from saralk/master
Browse files Browse the repository at this point in the history
Added callbacks for slide changes
  • Loading branch information
Victa committed Aug 8, 2012
2 parents c652e94 + 477aa8b commit e712bbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion curtain.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
controls: null,
curtainLinks: '.curtain-links',
enableKeys: true,
easing: 'swing'
easing: 'swing',
nextSlide: null,
prevSlide: null
};

// The actual plugin constructor
Expand Down Expand Up @@ -246,6 +248,11 @@


if(docTop < self.currentP && self.$current.index() > 0){
if (self.options.prevSlide) {
self.options.prevSlide();
}


// Scroll top
self._ignoreHashChange = true;
if(self.$current.prev().attr('id'))
Expand Down Expand Up @@ -304,6 +311,9 @@
}

} else {
if (self.options.nextSlide) {
self.options.nextSlide();
}
// Scroll bottom
self._ignoreHashChange = true;
if(self.$current.next().attr('id'))
Expand Down
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ $('.curtains').data('plugin_curtain').insert({

**``id``, ``class``, ``insertAfter`` and ``goTo`` attributes are optional.**

### Add callbacks to slide change events

You can fire a callback when the slide changes

```js
$('.curtains').curtains({
nextSlide: function() { console.log('next slide'); },
prevSlide: function() { console.log('previous slide')}
});
```


## Compatibility

Expand Down

0 comments on commit e712bbe

Please sign in to comment.