Tags

Follow MOSSLover’s blog, I managed to get Quick Launch Bar with Slider.

just paste the following script in your default.master page

var _Menus = [];
_Menus.push(“zz2_QuickLaunchMenu“);

//attach to the load/onload event the method
//to add the handler to add the animations when
//menu section is clicked.
if (window.addEventListener)
{window.addEventListener(“load”, AttachMenuAnimation, false);}
else if (window.attachEvent)
{window.attachEvent( “onload”, AttachMenuAnimation );}

function AttachMenuAnimation()
{
if (_Menus != null) {
for ( i=0; i < _Menus.length; i++)
{
InitMenuAnimations(_Menus[i]);
}
}

}
//this function will attach events to all the TR elements that
//have IDs
function InitMenuAnimations(cntrl)
{
//get all of the TR elements in the table, TBODY is the first element
//so get all of the TR elements from the TBODY element
var allTr = document.getElementById(cntrl).childNodes[0].childNodes;

//loop through all of the TR objects and if it has an ID
//it is a section header so attach an event to hide or unhide
//its content, Attach the event in a non destructive manner
for(i=0;i < allTr.length;i++)
{
if (allTr[i].id != “”){
allTr[i].MyClick = HideUnhide;
//add the handler
XBrowserAddHandler(allTr[i],”click”,”MyClick”);
}
}
}

function XBrowserAddHandler(target,eventName,handlerName) {
if ( target.addEventListener ) {
target.addEventListener(eventName, function(e){target[handlerName](e);}, false);
} else if ( target.attachEvent ) {
target.attachEvent(“on” + eventName, function(e){target[handlerName](e);});
} else {
var originalHandler = target[“on” + eventName];
if ( originalHandler ) {
target[“on” + eventName] = function(e){originalHandler(e);target[handlerName](e);};
} else {
target[“on” + eventName] = target[handlerName];
}
}
}

function HideUnhide(e)
{
var el = this.nextSibling;
if (el.id == “”){
if (el.style.display == “none”)
el.style.display = “block”;
else
el.style.display = “none”;
}
}

“zz2_QuickLaunchMenu” is the client id of QuickLaunchMenu. If you create a webpart you need to replace zz2_QuickLaunchMenu with _Menus.push(“”);

Advertisements