Click here to Skip to main content
15,885,309 members
Articles / Web Development / CSS3
Tip/Trick

SharePoint 2013 Web Part ToolPane Tweak

Rate me:
Please Sign up or sign in to vote.
4.60/5 (3 votes)
25 Jan 2014CPOL 17.3K   2
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)


Written By
Software Developer
United Arab Emirates United Arab Emirates
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionGreat Idea, simple implementation Pin
Andy Taw28-Jan-14 2:39
Andy Taw28-Jan-14 2:39 
AnswerRe: Great Idea, simple implementation Pin
Ahmad F Hassan29-Jan-14 21:21
professionalAhmad F Hassan29-Jan-14 21:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.