Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / CSS3

SharePoint 2013 Web Part ToolPane Tweak

4.60/5 (3 votes)
25 Jan 2014CPOL 17.8K  
5 minute trick

Introduction

This is a 5 minute trick that - I think - should be done for all branded SharePoint projects, to solve the issue of Web Part Properties Tool Pane.

Instead of disturbing the page with the tool pane when editing the web part, make it fixed to the left and to slide out on hover only!

Image 1     Image 2 

Using the Code

You only need to copy the CSS classes to your custom styles and the same for the JavaScript:

JavaScript:

JavaScript
$(document).ready(function(){
var IsEditMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;

if (IsEditMode == "1") {        
        $("form#aspnetForm").append($("<div id='editPanel'>"));
        $("#editPanel").css("height", (innerHeight - 240) + "px");
        $("#MSOTlPn_MainTD").css("width", "0");
        $("#editPanel").append($("#MSOTlPn_Tbl"));

        if ($("#MSOTlPn_Tbl").length > 0)
            $("#editPanel").css("min-width", "300px");

        $("#editPanel").animate({ "left": "-320px", "opacity": "1" }, 700);

        $("#editPanel").on("mouseenter", function () {
            $(this).stop();
            $("#MSOTlPn_Tbl").stop();
            $("#MSOTlPn_Tbl").animate({ "opacity": "1" }, 500);
            $(this).animate({ "left": "0" }, 500);
        });

        $("#editPanel").on("mouseleave", function () {
            $(this).stop();
            $("#MSOTlPn_Tbl").stop();
            $("#MSOTlPn_Tbl").animate({ "opacity": "0" }, 500);
            $(this).animate({ "left": "-320px" }, 500);
        })
    } 
}) 

CSS:

CSS
 #MSOTlPn_Tbl {
    opacity: 0;
}

#editPanel {    
    opacity: 0;
    border-radius: 5px;
	box-shadow: 0 0 50px #aaa;
	border: 4px solid #74A1FF;
	position: fixed;
	bottom: 25px;
	z-index: 9999;
	left: -320px;
	overflow-y: auto;
	padding: 20px;
	background-color: #fff;
} 

Give it a try!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)