Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Which version are you running? I added a fix in April last year to re-trigger on smart navigation scenarios but might be it only works if you reference a script and not inline ones. Commented Jan 28, 2021 at 13:02
  • Thanks for your comment. I had installed the latest version 1.0.0.16. I added a .gif to demonstrate what's happening. Basically the CanvasComponent gets resized to 33% max-width. That works. However, if I clicka nav link to move into another library and go back home the script is no longer applied and the width is the default. Any idea? Thanks. Commented Jan 29, 2021 at 13:52
  • I don't have repro, and seems to work as intented. I used the below which sets width of the header of a modern page. Alert is there to show it triggers on each navigation. <script type="text/javascript"> var elem = document.querySelectorAll("[class='webPartContainer']"); elem[0].style.maxWidth = '80%'; alert('a'); </script> Commented Jan 29, 2021 at 18:02
  • Thanks for testing. So alert() always works even when coming back from another navigation node. However, applied styles don't like described. Can you test with hiding the site title? <script type="text/javascript"> let elem = document.querySelectorAll("span[role*='heading']"); elem[0].style.display = 'none'; </script> That also doesn't work but it should be easier for you to test. Thanks. Commented Jan 30, 2021 at 12:46
  • Works fine, but you have to replace "let" with "var", as let is not a JavaScript keyword. (Which I did the first time around as well.) Commented Feb 1, 2021 at 7:29