changeset f6eff9a92dea in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=f6eff9a92dea
description:
        Replace affix by sticky position

        issue8214
        review259181002
diffstat:

 src/sao.less |   6 ++++--
 src/tab.js   |  47 +----------------------------------------------
 2 files changed, 5 insertions(+), 48 deletions(-)

diffs (87 lines):

diff -r 8f530d86aaec -r f6eff9a92dea src/sao.less
--- a/src/sao.less      Thu Mar 28 19:31:18 2019 +0100
+++ b/src/sao.less      Thu Mar 28 19:33:23 2019 +0100
@@ -67,8 +67,10 @@
 .table-row-variant(selected, @state-info-bg);
 
 .tab-form, .tab-board {
-    nav.toolbar.affix {
-        top: @navbar-height + 1px;
+    nav.toolbar {
+        position: -webkit-sticky;
+        position: sticky;
+        top: 0px;
         z-index: @zindex-navbar - 1;
     }
 
diff -r 8f530d86aaec -r f6eff9a92dea src/tab.js
--- a/src/tab.js        Thu Mar 28 19:31:18 2019 +0100
+++ b/src/tab.js        Thu Mar 28 19:33:23 2019 +0100
@@ -190,9 +190,6 @@
                 'class': 'btn-toolbar navbar-right flip',
                 'role': 'toolbar'
             })));
-            var wrapper = jQuery('<div/>', {
-                'class': 'toolbar-wrapper'
-            }).append(toolbar);
             this.set_menu(toolbar.find('ul[role*="menu"]'));
 
             var group;
@@ -268,30 +265,7 @@
                     jQuery(this).parents('.btn-group')
                         .addClass('hidden-xs');
                 });
-            var tabs = jQuery('#tabs');
-            toolbar.affix({
-                'target': tabs.parent(),
-                'offset': {
-                    'top': function() {
-                        return jQuery('#main_navbar').height();
-                    }
-                }
-            });
-            toolbar.on('affix.bs.affix', function() {
-                wrapper.height(jQuery('#main_navbar').height());
-            });
-            toolbar.on('affix-top.bs.affix affix-bottom.bs.affix',
-                    function() {
-                        wrapper.height('');
-                    });
-            toolbar.on('affixed.bs.affix', function() {
-                Sao.Tab.affix_set_with(toolbar);
-            });
-            toolbar.on('affixed-top.bs.affix affixed-bottom.bs.affix',
-                    function() {
-                        Sao.Tab.affix_unset_width(toolbar);
-                    });
-            return wrapper;
+            return toolbar;
         },
         show: function() {
             jQuery('#tablist').find('a[href="#' + this.id + '"]').tab('show');
@@ -333,25 +307,6 @@
         },
     });
 
-    Sao.Tab.affix_set_with = function(toolbar) {
-        var width = jQuery(toolbar.parent()).width();
-        toolbar.css('width', width);
-    };
-    Sao.Tab.affix_unset_width = function(toolbar) {
-        toolbar.css('width', '');
-    };
-    jQuery(window).resize(function() {
-        jQuery('.toolbar').each(function(i, toolbar) {
-            toolbar = jQuery(toolbar);
-            toolbar.affix('checkPosition');
-            if (toolbar.hasClass('affix')) {
-                Sao.Tab.affix_set_with(toolbar);
-            } else {
-                Sao.Tab.affix_unset_width(toolbar);
-            }
-        });
-    });
-
     Sao.Tab.counter = 0;
     Sao.Tab.tabs = [];
     Sao.Tab.tabs.close = function(warning) {

Reply via email to