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

Configuration? #212

Open
zaszlo opened this issue Nov 8, 2017 · 0 comments
Open

Configuration? #212

zaszlo opened this issue Nov 8, 2017 · 0 comments

Comments

@zaszlo
Copy link

zaszlo commented Nov 8, 2017

Hello, I have just downloaded the production version and included it in my site, added as a dependency, set up an anchor with du-smooth-scroll but has no effect. Is there something more to configure?
It is injected:

var app = angular.module('app', [ ..., 'duScroll' ]);
...
function invertedEasingFunction(x) {
		  return 1-x;
	};
	angular.module('myApp', ['duScroll'])
	  .value('duScrollDuration', 2000)
	  .value('duScrollEasing', invertedEasingFunction)
	  .value('duScrollOffset', 30)
	  .controller('myCtrl', function($scope, $document) {
    $document.scrollTopAnimated(400).then(function() {
      console && console.log('You just scrolled to the top!');
    });
...

The console doesn't show any js errors show I guess all is well... Inside the html:
<a du-smooth-scroll="recipes" </a>

The recipes anchor exists. I used a directive to escape the angularjs's behavior as it doesn't handle simple href calls with hashes, because it transforms # to #/ and breaks the scroll to element... But this directive doesn't use smooth scroll. This is why I turned to this module. The directive that I use and works is:

app.directive('scrollto',
		       function ($anchorScroll,$location) {
		            return {
		                link: function (scope, element, attrs) {
		                    element.click(function (e) {
		                        e.preventDefault();
		                        $location.hash(attrs["scrollto"]);
		                        $anchorScroll();
		                    });
		                }
		            };
		    })

Do you have any suggestions to solve this issue of mine?

Thanks.

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

1 participant