Question Background:
I am using Jasny Bootstrap's Reveal Menu. A demo can be found here:
http://codepen.io/michaelbowlin/pen/lDqpm
The Issue:
Within my reveal menu I have a form that requires the revealed panel to be scrolled up to the top when the button is either opened or closed from a click. The following shows the menu panel revealed with the scroll bar active:
The following is the menu markup for the menu:
<div class="navmenu navmenu-default navmenu-fixed-left" id="updateMenu">
//*********Form**********
</div>
<div class="navbar navbar-default navbar-fixed-top">
<button id="menuBtn" type="button" ng-click="ScrollUp()" class="navbar-toggle" data-toggle="offcanvas" data-recalc="false" data-target=".navmenu" data-canvas=".canvas">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
I have added a ng-click directive on the Button markup and give this the ID of updateMenu. This calls a function named ScrollUp() on the $scope object on the UpdateController, as shown:
app.controller('UpdateController', function ($scope, $timeout, $location, $anchorScroll, $window, searchService) {
$scope.ScrollUp = function () {
$location.hash('#updateMenu');
$anchorScroll();
}
}
Currently this does not work. I have also tried the following functionality which does not work:
app.controller('UpdateController', function ($scope, $timeout, $location, $anchorScroll, $window, searchService) {
$scope.ScrollUp = function () {
$window.scrollTo(0, angular.element('#updateMenu').offsetTop);
}
}
How can I scroll up to the top of the revealed menu when the user clicks the button updateMenu?
