Skip to content

Configuration? #212

@zaszlo

Description

@zaszlo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions