Browse Source

Add scroll to top on inline item delete

Denis K 8 years ago
parent
commit
275973ae56
1 changed files with 8 additions and 0 deletions
  1. 8 0
      jet/static/jet/js/src/features/compact-inline.js

+ 8 - 0
jet/static/jet/js/src/features/compact-inline.js

@@ -85,12 +85,20 @@ CompactInline.prototype = {
     },
     openFirstNavigationItem: function($inline) {
         this.openNavigationItem($inline, $inline.find('.inline-navigation-item').first());
+        this.scrollNavigationToTop($inline);
     },
     addItemDeleteButton: function($item) {
         $item
             .children(':first')
             .append('<span><a class="inline-deletelink" href="#">' + this.deleteText + "</a></span>");
     },
+    scrollNavigationToTop: function($inline) {
+        var $navigationItemsContainer = $inline.find('.inline-navigation-content');
+
+        $navigationItemsContainer.stop().animate({
+            scrollTop: 0
+        });
+    },
     scrollNavigationToBottom: function($inline) {
         var $navigationItemsContainer = $inline.find('.inline-navigation-content');