0

I am going to add a custom div in b/w ribbon and workspace div. I find the scrolling bug

HTML

<!-- ribbon -->
<div class="s4-pr s4-ribbonrowhidetitle" id="s4-ribbonrow" style="height: 44px;">
</div>
<!-- ribbon end -->

<!-- ribbon -->
<div id="s4-header">
  custom header
</div>
<!-- ribbon -->

<!-- ribbon -->
<div id="s4-workspace" style="height: 1045px; width: 1600px;">
</div>
<!-- ribbon -->

this is the structure of masterpage.

and I m using the following jquery script.

function FixWorkspace() {
  // if you are using a header that is affixed to the top (i.e. SharePoint Ribbon) put the ID or class here to change the workspace height accordingly.
  var header = '#s4-header';
  var width = $(window).width();
  var height;
  if ($(header).length) {
    height = $(window).height() - ($(header).height()+90);
  } else {
    height = $(window).height();
  }
  $('#s4-workspace').width(width).height(height);
}

$(document).ready(function() {
   FixWorkspace();
});

$(window).resize(function() {
   FixWorkspace();
});

on page load, this script works and set the height value but suddenly after some seconds it revert to default height value (i.e 1045px ). any help in this regards.

2
  • I wouldn't put anything between these to DIVs. What if you place your div inside #s4-workspace? Jan 26, 2015 at 13:27
  • I can, but the issue is... when you scroll down, the custom div will hide behid the riboon.
    – fmj
    Jan 27, 2015 at 7:30

1 Answer 1

-1

Try this way:

  1. Remove the inline height and move to external css
  2. Now apply your JQuery Script.
7
  • any idea, how to remove the inline height :).
    – fmj
    Jan 27, 2015 at 7:30
  • If the inline script is added dynamically, you have to run your script after the default script is loaded.
    – Shiva
    Jan 27, 2015 at 10:40
  • yes, I already tried this, my jquery script in just before </body> tag
    – fmj
    Jan 28, 2015 at 5:22
  • 1) You can try using differ if your are using script src or 2) use sharepoint scriptlink and aftercss property
    – Shiva
    Jan 28, 2015 at 5:30
  • you mean <script src="" >
    – Shiva
    Jan 28, 2015 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.