4

Initially I have body with css as overflow scroll.How can i change the body css to overflow hidden when particular span occurs.Is there any way to fix it?

3

Follow the screenshot

Step 1 Step 2 Step 3 Step 4

Then apply the above code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
if ($('#spanemelementid').length) {
     $('body').css('overflow','hidden');
}
});
</script>
-1

You have to use JQuery for this:

$(document).ready(function(){
if ($('#spanemelementid').length) {
     $('body').css('overflow','hidden');
}
});
  • where should I include this – Divya Oct 3 '16 at 8:45
  • You can add scripteditor webpart and put this code in that page. Make sure Jquery is loaded in the page – Unnie Oct 3 '16 at 8:46
  • jQuery isn't necessary to do this. – iOnline247 Oct 9 '16 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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