Why not use CSS instead of JQuery

Jan 28, 2013 at 7:03 PM

Thank you, but I have modified my project as described below to fix 2 problems :

1.  There was some flickering on the ribbon showing for a fraction of seconds

2. Removed the problematic reference to JQuery (in our case we cannot use $)

In RibbonVisibility.ascx the only contents is now :

<SharePoint:CssLink runat="server" ID="cssLinkRibbonVisibility" />

and I modified InjectScripts() this way :

private void InjectScript(){
   var cssFile = "/_controltemplates/SPRibbonVisibility/RibbonVisibility.css";   if (_collapseFreeSpace)   cssFile = "/_controltemplates/SPRibbonVisibility/RibbonVisibility_collapsed.css";
   cssLinkRibbonVisibility.DefaultUrl = cssFile;

both .js files are now css files containing respectively :

   #s4-ribboncont {
   #s4-ribbonrow {