mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
Smooth scrolling, svg support via directive
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, $anchorScroll, $rootScope, HashNavigation) ->
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs, $document, $rootScope, HashNavigation) ->
|
||||
$scope.Hubs = Hubs
|
||||
$scope.hubs = Hubs.hubs
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Darkswarm.directive "renderSvg", ()->
|
||||
restrict: 'E'
|
||||
priority: 99
|
||||
template: "<svg-wrapper></svg-wrapper>"
|
||||
link: (scope, elem, attr)->
|
||||
if /.svg/.test attr.path # Only do this if we've got an svg
|
||||
$.ajax
|
||||
url: attr.path
|
||||
success: (html)->
|
||||
elem.html($(html).find("svg"))
|
||||
@@ -4,5 +4,7 @@ Darkswarm.directive 'scrollAfterLoad', ($timeout, $location, $document)->
|
||||
if scope.$last is true
|
||||
$(window).load ->
|
||||
$timeout ->
|
||||
$document.scrollTo $("##{$location.hash()}"), 100, 200, (x)->
|
||||
x * (2 - x)
|
||||
elem = $("##{$location.hash()}")
|
||||
if elem.length > 0
|
||||
$document.scrollTo elem , 100, 200, (x)->
|
||||
x * (2 - x)
|
||||
|
||||
Reference in New Issue
Block a user