Return to Snippet

Revision: 38949
at January 11, 2011 00:49 by fauverism


Initial Code
// JavaScript Document

	$(function(){
		//initialize menus
	    var menuRows = $("[id$='QuickLaunchMenu'] > tbody > tr");
	    var menuHd = menuRows.filter("[id]:has(+tr:not([id]))");

	    //set img path for when submenu is hidden
	    var closedImg = "/_layouts/images/Menu1.gif";

	    //set img path for when submenu is visible
	    var openedImg = "/_layouts/images/ptclose.gif";

	    var cssInit = {
	        "background-image": "url('"+closedImg+"')",
	        "background-repeat": "no-repeat",
	        "background-position": "100% 50%"
	    }
	    var cssClosed = {"background-image": "url('"+closedImg+"')"}
	    var cssOpen = {"background-image": "url('"+openedImg+"')"}

	    //hide submenus
	    menuRows.filter(":not([id])").hide();

	    //apply initial inline style to menu headers
	    menuHd.find("td:last").css(cssInit);

	    menuHd.click(function () {
	        var styleElm = $(this).find("td:last")
	        var nextTR = $(this).next("tr[id='']");
	        if (nextTR.is(":not(':hidden')")) {
	            nextTR.hide();
	            styleElm.css(cssClosed);
	        } else {
	            nextTR.show();
	            styleElm.css(cssOpen);
	        }
	    });
		$('a.ms-selectednav').parents('tr').eq(2).show();
	});

Initial URL

                                

Initial Description

                                

Initial Title
Sharepoint Left Nav Accordion sub

Initial Tags

                                

Initial Language
JavaScript