Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Samuel Butler 3 posts 105 karma points
    Jan 24, 2019 @ 01:37
    Samuel Butler
    0

    Scroll To Element for Custom Dashboard

    Hi all,

    I am currently trying to add scroll to functionality for the Kompair package custom dashboard. What I am trying to achieve is that when a user clicks on an element, an Angularjs controller function is called with the id of the element to scroll to.

    I am having some issues getting the scrollable div element to scroll to the target element. Is there something special I need to do to achieve this for umbraco dashboards as the usual methods are not working for me?

    $scope.scrollTo = function (scrollTarget) {
     var target = $("#" + scrollTarget);
     var container = $(".umb-editor-container.umb-panel-body.umb-scrollable");
    
     if (!target) {
         return;
     }
    
      if (!container) {
        return;
      }
    
      container.scrollTop = target.offsetTop;
    };
    
  • Samuel Butler 3 posts 105 karma points
    Jan 24, 2019 @ 03:17
    Samuel Butler
    100

    Worked it out. I needed to use animate which I did try at first but not on the scrollable div itself, I was doing animate on the body.

Please Sign in or register to post replies

Write your reply to:

Draft