Skip to end of banner
Go to start of banner

SubSpace and Linchpin Theme not working properly

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Problem

When using SubSpace and the Linchpin Theme Add-on the SubSpace bar is not integrated properly.

 

Solution

Please add the following script to the custom html section:

<script type="text/javascript">
    jQuery(document).ready(function() {        
        var observerOverlayHeader;
        var observerSidebar;        
    
        var fixTheme = function() {
            jQuery('#navigationbarpro .aui-navgroup.aui-navgroup-horizontal').css('margin', '0px');
            jQuery('#navigationbarpro .aui-navgroup-inner .aui-navgroup-secondary').prependTo('#navigationbarpro .aui-navgroup-inner');
            jQuery('#navigationbarpro .aui-navgroup-inner .aui-navgroup-primary.subspaces-menu').css('clear', 'inherit');
            jQuery('#navigationbarpro .aui-navgroup-inner .aui-navgroup-primary.subspaces-menu').css('float', 'none');
            jQuery('#navigationbarpro .aui-navgroup-inner .aui-navgroup-primary.subspaces-menu .aui-nav').css('float', 'none');
            
            var subspaceNavigationHeight = jQuery('#navigationbarpro').height();
            var headerMessage = jQuery('#header-precursor');
        
            if(AJS.Meta.get('page-id') === undefined) {
                if(AJS.Meta.get('space-key') === undefined) {
                    jQuery('#page .PageContent').css('margin-top', subspaceNavigationHeight + 'px');
                } else {
                    jQuery('#page .ia-splitter').css('margin-top', subspaceNavigationHeight + 'px');
                }            
            } else {
                if(observerOverlayHeader !== undefined || observerSidebar !== undefined) {
                    observerOverlayHeader.disconnect();
                    observerSidebar.disconnect();
                }
                
                jQuery('#page .ia-splitter').css('margin-top', subspaceNavigationHeight + 'px');
                
                Subspace.lastScrollTop = -1;
                observerOverlayHeader = new MutationObserver(function(mutations) {
                  mutations.forEach(function(mutation) {
                    var header = jQuery('#main-header.overlay-header');
                    if(header.length > 0) {                        
                        var newValue = header.css('top');
                        var st = $(document).scrollTop();
                        
                        if (st < Subspace.lastScrollTop || Subspace.lastScrollTop == -1){
                            setTimeout(function() {                                
                                newValue = (180 + subspaceNavigationHeight) + 'px';
                                header.css('top', newValue);
                            }, 20);
                        }
                        
                        if (st > Subspace.lastScrollTop && Subspace.lastScrollTop != -1){
                            setTimeout(function() {                                
                                newValue = (120 + subspaceNavigationHeight) + 'px';
                                header.css('top', newValue);
                            }, 20);
                        }
                        
                        Subspace.lastScrollTop = st;
                    }
                  });    
                });
                
                observerSidebar = new MutationObserver(function(mutations) {
                  mutations.forEach(function(mutation) {
                    setTimeout(function() {
                        var newHeight = 180 + subspaceNavigationHeight;
                        if(headerMessage.length > 0 && (jQuery(window).scrollTop() < headerMessage.height())) {
                            newHeight += headerMessage.height();
                        }
                        
                        jQuery('#page .ia-splitter .ia-fixed-sidebar').css('top', newHeight + 'px');
                    }, 20);
                  });    
                });
                 
                var config = { attributes: true };
                 
                var target = document.querySelector('#main-header');
                observerOverlayHeader.observe(target, config);
                
                target = document.querySelector('#page .ia-splitter .ia-fixed-sidebar');
                observerSidebar.observe(target, config);
                
                target = document.querySelector('#main');
                observerSidebar.observe(target, config);
            }
            
            Subspace.subspaceNavigationHeight = subspaceNavigationHeight;
        };
        
        $('#navigationconfigdialog button.aui-button-primary').click(function() {
            setTimeout(function() {
                var headerMessage = jQuery('#header-precursor');
                var newHeight = jQuery('#navigationbarpro').height() > Subspace.subspaceNavigationHeight ? 142 + jQuery('#navigationbarpro').height() : 180 + jQuery('#navigationbarpro').height();
                if(headerMessage.length > 0 && (jQuery(window).scrollTop() < headerMessage.height())) {
                    newHeight += headerMessage.height();
                }
                
                jQuery('#page .ia-splitter .ia-fixed-sidebar').css('top', newHeight + 'px');
                
                fixTheme();
            }, 20);
        });
        
        fixTheme();
    });
</script>

 



 

  • No labels