Skip to content

Commit

Permalink
Merge pull request #5 from desktime/add-scroll-method
Browse files Browse the repository at this point in the history
Adds a scrollToHandler option to Shepherd Defaults.
  • Loading branch information
b-ash committed Jan 23, 2015
2 parents 98f313a + 1cb3a89 commit 1b1bd9a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
5 changes: 4 additions & 1 deletion coffee/shepherd.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ class Step extends Evented
scrollTo: =>
{element} = @getAttachTo()

element?.scrollIntoView()
if @options.scrollToHandler?
@options.scrollToHandler(element)
else
element?.scrollIntoView()

destroy: =>
if @el?
Expand Down
6 changes: 5 additions & 1 deletion js/shepherd.js

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

6 changes: 5 additions & 1 deletion shepherd-amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@
Step.prototype.scrollTo = function() {
var element;
element = this.getAttachTo().element;
return element != null ? element.scrollIntoView() : void 0;
if (this.options.scrollToHandler != null) {
return this.options.scrollToHandler(element);
} else {
return element != null ? element.scrollIntoView() : void 0;
}
};

Step.prototype.destroy = function() {
Expand Down
2 changes: 1 addition & 1 deletion shepherd-amd.min.js

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

6 changes: 5 additions & 1 deletion shepherd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,11 @@ return this.Tether;
Step.prototype.scrollTo = function() {
var element;
element = this.getAttachTo().element;
return element != null ? element.scrollIntoView() : void 0;
if (this.options.scrollToHandler != null) {
return this.options.scrollToHandler(element);
} else {
return element != null ? element.scrollIntoView() : void 0;
}
};

Step.prototype.destroy = function() {
Expand Down
2 changes: 1 addition & 1 deletion shepherd.min.js

Large diffs are not rendered by default.

0 comments on commit 1b1bd9a

Please sign in to comment.