{"id":1117,"date":"2013-11-13T16:17:48","date_gmt":"2013-11-13T15:17:48","guid":{"rendered":"http:\/\/blog.repsaj.nl\/?p=1117"},"modified":"2013-11-13T16:17:48","modified_gmt":"2013-11-13T15:17:48","slug":"sp2013-hiding-the-ribbon-in-dialog-view","status":"publish","type":"post","link":"http:\/\/blog.repsaj.nl\/index.php\/2013\/11\/sp2013-hiding-the-ribbon-in-dialog-view\/","title":{"rendered":"SP2013: Hiding the ribbon in dialog view"},"content":{"rendered":"<p>Today I was working on a page which is displayed in a dialog view. Trimming SharePoint bits and pieces is easily done by adding IsDlg=1 to the querystring of the page. But&#8230; this does <strong>not<\/strong> hide the ribbon.<\/p>\n<p>Ok, so how to hide the ribbon too then, when required? There&#8217;s a simple piece of CSS for that:<\/p>\n<pre class=\"prettyprint\">&lt;style type=\"text\/css\"&gt;\r\n#s4-ribbonrow, .ms-cui-topBar2, .s4-notdlg, .s4-pr s4-ribbonrowhidetitle, .s4-notdlg noindex, #ms-cui-ribbonTopBars, #s4-titlerow, #s4-pr s4-notdlg s4-titlerowhidetitle, #s4-leftpanel-content {display:none !important;}\r\n.s4-ca{margin-left:0px !important; margin-right:0px !important;}\r\n&lt;\/style&gt;<\/pre>\n<p>Suppose you add this snippet to a\u00a0script editor web part which you added to your page. You save the page and&#8230; wait&#8230; how the\u00a0heck\u00a0\u00a0would you save the page without the ribbon? As soon as you save your code snippet, the CSS is inserted and the ribbon disappears. Now what?<\/p>\n<p>Well&#8230; when you add IsDlg=1 to your page, this inserts CSS classes as well. Especially the &#8220;ms-dialog&#8221; class which is added to the HTML tag of your page. So make use of that and prefix your &#8220;hide the ribbon&#8221; CSS classes with it. This way, the ribbon will only be hidden in dialog view, and still usable in normal view.<\/p>\n<pre class=\"prettyprint\">&lt;style type=\"text\/css\"&gt;\r\n.ms-dialog #s4-ribbonrow, .ms-dialog .ms-cui-topBar2, .ms-dialog .s4-notdlg, .ms-dialog .s4-pr s4-ribbonrowhidetitle, .ms-dialog .s4-notdlg noindex, .ms-dialog #ms-cui-ribbonTopBars, .ms-dialog #s4-titlerow, .ms-dialog #s4-pr s4-notdlg s4-titlerowhidetitle, .ms-dialog #s4-leftpanel-content {display:none !important;}\r\n.ms-dialog .s4-ca{margin-left:0px !important; margin-right:0px !important;}\r\n&lt;\/style&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Today I was working on a page which is displayed in a dialog view. Trimming SharePoint bits and pieces is easily done by adding IsDlg=1 to the querystring of the page. But&#8230; this does not hide the ribbon. Ok, so how to hide the ribbon too then, when required? There&#8217;s a simple piece of CSS<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[34],"tags":[7],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3KFR1-i1","_links":{"self":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/1117"}],"collection":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1117"}],"version-history":[{"count":0,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/1117\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/categories?post=1117"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/tags?post=1117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}