You can find one Demo of the thing you've mentioned as the attachment. Open the zip browse the HTML page and
(a) If you hover your mouse you can view the underline in the menu header.
(b) If you click on the menu title then it will first do whatever the slashdot menu code intends after it will go to the link you've mentioned.
I've made changes in the following areas:
(1) In sdmenu.js
Done the changes in the following methods. Highlighted the newly added code
Code:
SDMenu.prototype.expandMenu = function(submenu) {
var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
var links = submenu.getElementsByTagName("a");
for (var i = 0; i < links.length; i++)
fullHeight += links[i].offsetHeight;
var moveBy = Math.round(this.speed * links.length);
var mainInstance = this;
var intId = setInterval(function() {
var curHeight = submenu.offsetHeight;
var newHeight = curHeight + moveBy;
if (newHeight < fullHeight)
submenu.style.height = newHeight + "px";
else {
clearInterval(intId);
submenu.style.height = "";
submenu.className = "";
mainInstance.memorize();
}
}, 30);
this.collapseOthers(submenu);
if(submenu.getElementsByTagName("span")[0].title){
window.location.href = submenu.getElementsByTagName("span")[0].title;
}
};
SDMenu.prototype.collapseMenu = function(submenu) {
var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
var mainInstance = this;
var intId = setInterval(function() {
var curHeight = submenu.offsetHeight;
var newHeight = curHeight - moveBy;
if (newHeight > minHeight)
submenu.style.height = newHeight + "px";
else {
clearInterval(intId);
submenu.style.height = "";
submenu.className = "collapsed";
mainInstance.memorize();
}
}, 30);
if(submenu.getElementsByTagName("span")[0].title){
window.location.href = submenu.getElementsByTagName("span")[0].title;
}
};
2. In sdmenu.css
Add the following CSS style in the CSS file.
Code:
div.sdmenu div span:hover{text-decoration:underline;}
3. The HTML markup needs to be adjusted. Precisely the span elements acting as the menu titles. Something like the following:
Code:
<span title="http://www.google.com">Online Tools</span>
In the menu title span element you use the 'title' attribute to specify the URL to which the page needs to be changed if one clicks on the menu title.
The attached files contains all the above mentioned changes in it and you just need to browse the 'index.html' file after unzipping.
Hope this helps.
Bookmarks