2

Is there any way to auto adjust a web page on Sharepoint 2013, given that Windows Display Style is often switched to "Larger - 150%"?

enter image description here

It doesn't have to do with screen resolution, so I wonder if there's any solution to let the sitepage auto adjust itself to fit the screen. Any thoughts?

1

I usually use javascript in a .txt file linked to a content editor web part.

In your case, you would probably want to set it to wi + px.

My code usually looks like this:

<script type="text/javascript" language="javascript">


$(document).ready(function() {


//  adjust navigation lists and  other tables to match nav bar width - Change sizes on smaller screens:
var wi = $(window).innerWidth(); 
var navwi = $(".Navigation").width();
var NavHeight = $(".Navigation").height();
var btnwi = $("input").width();
var HeadHeight = $("#MSOImageWebPart_WebPartWPQ3").height();
var NameHeight = $("#MSOImageWebPart_WebPartWPQ11").height();


        $("#MSOImageWebPart_WebPartWPQ3").css({
        width: wi + "px",
        });

        $(".ms-WPBody").css({
        width: wi + "px",
        margin: "auto"
        });

        $(".navigation").css({
        width: wi -50 + "px",
        margin: "auto"
        });

        $(".s4-wpTopTable").css({
        width: navwi + "px",
        margin: "auto"
        });

</script>
7
  • Seems a very interesting solution! So I changed "#MSOImageWebPart_WebPartWPQ3" and "#MSOImageWebPart_WebPartWPQ11" with the ID of the web parts that I have in my page. What else do I have to change to make it work? Nov 28 '16 at 14:31
  • That was an example of one I've used. If your page has a multiple web parts. you may be able to use the below.
    – Goldenjc97
    Nov 28 '16 at 14:42
  • <script type="text/javascript" language="javascript"> $(document).ready(function() { // adjust navigation lists and other tables to match nav bar width - Change sizes on smaller screens: var wi = $(window).innerWidth(); $(".ms-WPBody").css({ width: wi + "px", margin: "auto" }); $(".s4-wpTopTable").css({ width: navwi + "px", margin: "auto" }); </script>
    – Goldenjc97
    Nov 28 '16 at 14:43
  • Unfortunately, neither the second script seems to be working. Do I need to custom anything? Nov 28 '16 at 16:09
  • What all is on your page? Is it just one webpart that you want to autosize the width of the page?
    – Goldenjc97
    Nov 28 '16 at 16:24

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.