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

Smooth Scroll Directive doesn't seem to work #2

Closed
creatifyme opened this issue Jun 12, 2013 · 8 comments
Closed

Smooth Scroll Directive doesn't seem to work #2

creatifyme opened this issue Jun 12, 2013 · 8 comments

Comments

@creatifyme
Copy link

I'm trying to make a scroll back to top button and I'm running into an error. Currently I'm not using jQuery but jQMobi. I have not tested to see if jQMobi is the hang up.

HTML:

Back To Top

Error I'm receiving:

Smooth scroll: scrolling to some-div with offset 100 angular.js:5754
Uncaught TypeError: Object function JQLite(element) {
if (element instanceof JQLite) {
return element;
}
if (!(this instanceof JQLite)) {
if (isString(element) && element.charAt(0) != '<') {
throw Error('selectors not implemented');
}
return new JQLite(element);
}

if (isString(element)) {
var div = document.createElement('div');
// Read about the NoScope elements here:
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
div.innerHTML = '

 
' + element; // IE insanity to make NoScope elements work!
div.removeChild(div.firstChild); // remove the superfluous div
JQLiteAddNodes(this, div.childNodes);
this.remove(); // detach the elements from the temporary DOM div.
} else {
JQLiteAddNodes(this, element);
}
} has no method 'find' ng.smoothscroll.js:1
e ng.smoothscroll.js:1
f ng.smoothscroll.js:1
(anonymous function) ng.smoothscroll.js:1
(anonymous function) angular.js:1992
forEach angular.js:130
eventHandler angular.js:1991

@arnaudbreton
Copy link
Owner

The "smooth-scroll" directive is written in pure JS so it should normally have no external dependencies in contrary of the "jquery" version.

Can you look into the Chrome Dev Tools where it is bugging? Or better try with the non-minified version?
You can get a copy by running grunt coffee:dist. The ouput will be in the ".tmp" folder.

@creatifyme
Copy link
Author

Never used coffee so it took some doing but got myself the non-minified version. I'm getting the same error as before but here is where it seems to be buggin out.

Error is line 38 of angular-smooth-scroll.js - has no method 'find':
elm = angular.element.find('#' + eID)[0];

@creatifyme
Copy link
Author

I replaced that with
elm = document.getElementById(eID);

And scrolling now works.

@arnaudbreton
Copy link
Owner

Oh ok it's here! Sounds like AngularJS jQlite is not playing well with jQMobi. You should open an issue there.

I will post a fix with your solution. Thanks!

@creatifyme
Copy link
Author

No problem.

@arnaudbreton
Copy link
Owner

Somebody has post a pull request improving the module. It should work without issues now.

Let us know if it's not the case.

@creatifyme
Copy link
Author

Works great. Thanks.

@arnaudbreton
Copy link
Owner

Great! Thanks for following up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants