Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm currently creating a own template for my page. I can't figure out how the focus on content button works: enter image description here

If I past in the following snippet from the seatle.html template the focus on content button works with this snippet. It seems to me it is associated with the given id sideNavBox, because if I remove it, it won't work any more.

<div id="sideNavBox" class="ms-dialogHidden ms-forceWrap ms-noList">
<!--SPM:<SharePoint:AjaxDelta id="DeltaPlaceHolderLeftNavBar" BlockElement="true" CssClass="ms-core-navigation" role="navigation" runat="server">-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">-->
<a id="startNavigation" name="startNavigation" tabIndex="-1">
</a>
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop" runat="server"/>-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderQuickLaunchTop" runat="server"/>-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" runat="server"/>-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat="server"/>-->
<!--SPM:<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server"/>-->
<div class="ms-core-sideNavBox-removeLeftMargin">
    <!--SPM:<SharePoint:SPNavigationManager
        id="QuickLaunchNavigationManager"
        runat="server" 
        QuickLaunchControlId="V4QuickLaunchMenu"
        ContainedControl="QuickLaunch"
        EnableViewState="false">-->
    <!--SPM:<SharePoint:DelegateControl runat="server" 
        ControlId="QuickLaunchDataSource">-->
    <!--SPM:<Template_Controls>-->
    <!--SPM:<asp:SiteMapDataSource 
        SiteMapProvider="SPNavigationProvider" 
        ShowStartingNode="False"
        id="QuickLaunchSiteMap" 
        StartingNodeUrl="sid:1025" 
        runat="server"/>-->
    <!--SPM:</Template_Controls>-->
    <!--SPM:</SharePoint:DelegateControl>-->
    <!--SPM:<SharePoint:AspMenu
        id="V4QuickLaunchMenu"
        runat="server"
        EnableViewState="false" 
        DataSourceId="QuickLaunchSiteMap"
        UseSimpleRendering="true"
        Orientation="Vertical"
        StaticDisplayLevels="3"
        AdjustForShowStartingNode="true"
        MaximumDynamicDisplayLevels="0"
        SkipLinkText=""/>-->
    <!--SPM:</SharePoint:SPNavigationManager>-->
    <!--SPM:<SharePoint:SPNavigationManager
        id="TreeViewNavigationManagerV4"
        runat="server" 
        ContainedControl="TreeView"
        CssClass="ms-tv-box">-->
    <!--SPM:<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/15/viewlsts.aspx" id="idNavLinkSiteHierarchyV4" Text="&#60;%$Resources:wss,treeview_header%&#62;" accesskey="&#60;%$Resources:wss,quiklnch_allcontent_AK%&#62;" 
        CssClass="ms-tv-header"/>-->
    <!--SPM:<SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">-->
    <!--SPM:<Template_Controls>-->
    <!--SPM:<SharePoint:SPHierarchyDataSourceControl
            runat="server"
            id="TreeViewDataSourceV4"
            RootContextObject="Web"
            IncludeDiscussionFolders="true"/>-->
    <!--SPM:<SharePoint:SPRememberScroll runat="server" id="TreeViewRememberScrollV4" onscroll="javascript:_spRecordScrollPositions(this);" 
            style="overflow: auto;">-->
    <!--SPM:<SharePoint:SPTreeView
            id="WebTreeViewV4"
            runat="server"
            ShowLines="false"
            DataSourceId="TreeViewDataSourceV4"
            ExpandDepth="0"
            SelectedNodeStyle-CssClass="ms-tv-selected"
            NodeStyle-CssClass="ms-tv-item"
            SkipLinkText=""
            NodeIndent="12"
            ExpandImageUrl="/_layouts/15/images/tvclosed.png?rev=23"
            ExpandImageUrlRtl="/_layouts/15/images/tvclosedrtl.png?rev=23"
            CollapseImageUrl="/_layouts/15/images/tvopen.png?rev=23"
            CollapseImageUrlRtl="/_layouts/15/images/tvopenrtl.png?rev=23"
            NoExpandImageUrl="/_layouts/15/images/tvblank.gif?rev=23">-->
    <!--SPM:</SharePoint:SPTreeView>-->
    <!--SPM:</SharePoint:SPRememberScroll>-->
    <!--SPM:</Template_Controls>-->
    <!--SPM:</SharePoint:DelegateControl>-->
    <!--SPM:</SharePoint:SPNavigationManager>-->
    <!--SPM:<asp:ContentPlaceHolder id="PlaceHolderQuickLaunchBottom" runat="server">-->
    <div class="ms-core-listMenu-verticalBox">
        <!--SPM:<SharePoint:ClusteredSPLinkButton
        runat="server"
        id="idNavLinkViewAll"
        PermissionsString="ViewFormPages"
        NavigateUrl="~site/_layouts/15/viewlsts.aspx"
        Text="&#60;%$Resources:wss,AllSiteContentMore%&#62;"
        accesskey="&#60;%$Resources:wss,quiklnch_allcontent_AK%&#62;"
        CssClass="ms-core-listMenu-item ms-core-listMenu-heading"/>-->
        <!--PS: Start of READ-ONLY PREVIEW (do not modify)--><a id="ctl00_idNavLinkViewAll" accesskey="3" class="ms-core-listMenu-item ms-core-listMenu-heading" href="#"><span class="ms-splinkbutton-text">All Site Content</span></a><!--PE: End of READ-ONLY PREVIEW-->
    </div>
    <!--SPM:</asp:ContentPlaceHolder>-->
</div>
<!--SPM:</asp:ContentPlaceHolder>-->
<!--SPM:</SharePoint:AjaxDelta>-->

How can I assign content collapse on any html-element in my template?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The focus on content method does two things: 1) it adds a cookie so that it knows to repeat the behavior when the page is loaded again, and 2) it adds a css class to the body: ms-fullscreenmode.

If you need to use that you can do CSS targeting to apply styles to your content. For instance:

.ms-fullscreenmode .myClassThatIsInsideTheBodyTag { display: none; }

In the above example, the myClassThatIsInsideTheBodyTag CSS only gets applied when inside an element with the ms-fullscreenmode class.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.