Skip to content

Commit

Permalink
[] accepts simple DOM elements
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudmolo committed Feb 11, 2014
1 parent da8cf09 commit ff0278a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ How To

include the ```SmoothScroll``` in your application dependencies

```SmoothScroll.$goTo(Number)``` return a promises resolved when the scroll is done
```SmoothScroll.$goTo(param)``` return a promises resolved when the scroll is done

``
var promise = SmoothScroll.$goTo(600);
Expand All @@ -32,6 +32,13 @@ include the ```SmoothScroll``` in your application dependencies
return SmoothScroll.$goTo(200);
});
```

``$goTo`` accepts :
number
simple DOM element
angular element
selector

---------

Next step:
Expand Down
5 changes: 4 additions & 1 deletion build/ng-smoothscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@
return {
$goTo: function(y, x) {
var defer, _ref;
if ((_ref = y[0]) != null ? _ref.tagName : void 0) {
if (((_ref = y[0]) != null ? _ref.tagName : void 0) != null) {
y = getElementTop(y[0]);
}
if (y.tagName != null) {
y = getElementTop(y);
}
if (typeof y === "string") {
y = getElementTop(document.querySelector(y));
}
Expand Down
2 changes: 1 addition & 1 deletion build/ng-smoothscroll.min.js

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

4 changes: 3 additions & 1 deletion src/ng-smoothscroll.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ angular.module("SmoothScroll", [])

{
$goTo: (y, x) ->
if y[0]?.tagName
if y[0]?.tagName?
y = getElementTop y[0]
if y.tagName?
y = getElementTop y
if typeof y is "string"
y = getElementTop document.querySelector y
defer = do $q.defer
Expand Down

0 comments on commit ff0278a

Please sign in to comment.