Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script for the Freeze Header
#1
Script for the Freeze Header?

*Below Script to be written on the Dashboard script as it is:

sdk.freezeHeader = function (grpName) {    var headerArr = $(".g_" + grpName); 
   //  group-name which needs to be fixed   
   var headerArrCompOffset = {};    
   var dashOffset = $(".draggablesParentDiv").offset(); 
   var maxZIndex = sdk.dashboard.m_widgetsArray.length;
   for (var i = 0; i < headerArr.length; i++) {        var compOffset = $(headerArr[i]).position();    
   /** make the hidden elements visible, get the position and hide again **/     
if ($(headerArr[i])[0] && $(headerArr[i])[0].style.display == "none") {            $(headerArr[i])[0].style.display = "block";  
   compOffset = $(headerArr[i]).position();            $(headerArr[i])[0].style.display = "none";        }     
var leftPos = compOffset.left * 1 + dashOffset.left * 1;   
headerArrCompOffset[headerArr[i].id] = compOffset.left * 1;       
sdk.applyStyles(headerArr[i], {            "position": "fixed",            "left": leftPos + "px",            "z-index": maxZIndex        });    }
$(document).scroll( function(scroll){        var dashOffset = $(".draggablesParentDiv").offset();   
for (var i = 0; i < headerArr.length; i++) {                var leftPos = headerArrCompOffset[headerArr[i].id] + dashOffset.left * 1 - $(window).scrollLeft();  
$(headerArr[i]).css('left',  leftPos);        };    });        
   $( window ).resize(function() {        var dashOffset = $(".draggablesParentDiv").offset();    
for (var i = 0; i < headerArr.length; i++) {                var leftPos = headerArrCompOffset[headerArr[i].id] + dashOffset.left * 1 - $(window).scrollLeft();            
$(headerArr[i]).css('left',  leftPos);        };    });    
};

*This Script should be written in the script of the First loading connection in the Dashboard.
*Should create a group of components that should be frozen and then that group name should be added in a script as written below(group name:fc):

sdk.freezeHeader('fc');
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)