locked
Javascript WebPart RRS feed

  • Question

  •  wanted to remove the left nav-panel to use the full width page for my web parts without loosing the upper menus and page controls,

    any how when I Google it , I found the simple solution :

     alter the CSS using a Script Editor web part. Place a Script Editor web part anywhere on the page, and add the following code. The first line removes the Quick Launch. The second line moves the code all the way to the left.

    <style>
    .ms-core-navigation { DISPLAY: none }
    #contentBox { margin-left: 0px }
    </style>

    So the problem is when I click save to apply this web part , it do nothing ,

    and when I open the web part again (it is empty )

    it seems like SharePoint Clear my script! even when I use the script editor for it !

    I need the JavaScript for many things, how to let SharePoint accept the JavaScript at JavaScript web part?


    thank u for help


    Saturday, September 28, 2013 2:09 PM

Answers

  • Hi Tareq,

    You need to use content editor webpart for this.

    Use the script editor webpart for javascript related stuff only.

    Regards,

    Sharath


    sharath kumart shivarama

    • Marked as answer by Patrick_Liang Sunday, October 6, 2013 8:50 AM
    Saturday, September 28, 2013 4:04 PM
  • Paste the same code in ur page layout and mark it  as important instead of using a web part
    • Marked as answer by Patrick_Liang Sunday, October 6, 2013 8:50 AM
    Saturday, September 28, 2013 5:18 PM
  • Hi,

    what I do in such cases is to create a normal txt or html file and save it to a document library, style library for example.

    Then, what you need is to copy shortcut of this file, add content editor web part to your page and just copy the link to your file in web part properties. Do not forget to make it a relative link.

    This way, you can reuse the same css on many pages...

    Hope it helps


    Robi MCT Kompas Xnet d.o.o. Ljubljana | blog: http://xblogs.kompas-xnet.si | website: http://www.kompas-xnet.si
    Slovenia
    Please vote if you find reply useful or mark it as answer.
    Thank you

    • Marked as answer by Patrick_Liang Sunday, October 6, 2013 8:50 AM
    Sunday, September 29, 2013 3:18 PM

All replies

  • Hi Tareq,

    You need to use content editor webpart for this.

    Use the script editor webpart for javascript related stuff only.

    Regards,

    Sharath


    sharath kumart shivarama

    • Marked as answer by Patrick_Liang Sunday, October 6, 2013 8:50 AM
    Saturday, September 28, 2013 4:04 PM
  • Paste the same code in ur page layout and mark it  as important instead of using a web part
    • Marked as answer by Patrick_Liang Sunday, October 6, 2013 8:50 AM
    Saturday, September 28, 2013 5:18 PM
  • Hi,

    what I do in such cases is to create a normal txt or html file and save it to a document library, style library for example.

    Then, what you need is to copy shortcut of this file, add content editor web part to your page and just copy the link to your file in web part properties. Do not forget to make it a relative link.

    This way, you can reuse the same css on many pages...

    Hope it helps


    Robi MCT Kompas Xnet d.o.o. Ljubljana | blog: http://xblogs.kompas-xnet.si | website: http://www.kompas-xnet.si
    Slovenia
    Please vote if you find reply useful or mark it as answer.
    Thank you

    • Marked as answer by Patrick_Liang Sunday, October 6, 2013 8:50 AM
    Sunday, September 29, 2013 3:18 PM